ab-angle->ABCF B

Percentage Accurate: 54.5% → 57.6%
Time: 43.3s
Alternatives: 9
Speedup: 32.2×

Specification

?
\[\begin{array}{l} \\ \begin{array}{l} t_0 := \pi \cdot \frac{angle}{180}\\ \left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin t\_0\right) \cdot \cos t\_0 \end{array} \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (let* ((t_0 (* PI (/ angle 180.0))))
   (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin t_0)) (cos t_0))))
double code(double a, double b, double angle) {
	double t_0 = ((double) M_PI) * (angle / 180.0);
	return ((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * sin(t_0)) * cos(t_0);
}
public static double code(double a, double b, double angle) {
	double t_0 = Math.PI * (angle / 180.0);
	return ((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * Math.sin(t_0)) * Math.cos(t_0);
}
def code(a, b, angle):
	t_0 = math.pi * (angle / 180.0)
	return ((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * math.sin(t_0)) * math.cos(t_0)
function code(a, b, angle)
	t_0 = Float64(pi * Float64(angle / 180.0))
	return Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * sin(t_0)) * cos(t_0))
end
function tmp = code(a, b, angle)
	t_0 = pi * (angle / 180.0);
	tmp = ((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * sin(t_0)) * cos(t_0);
end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin t\_0\right) \cdot \cos t\_0
\end{array}
\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 9 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: 54.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \pi \cdot \frac{angle}{180}\\ \left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin t\_0\right) \cdot \cos t\_0 \end{array} \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (let* ((t_0 (* PI (/ angle 180.0))))
   (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin t_0)) (cos t_0))))
double code(double a, double b, double angle) {
	double t_0 = ((double) M_PI) * (angle / 180.0);
	return ((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * sin(t_0)) * cos(t_0);
}
public static double code(double a, double b, double angle) {
	double t_0 = Math.PI * (angle / 180.0);
	return ((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * Math.sin(t_0)) * Math.cos(t_0);
}
def code(a, b, angle):
	t_0 = math.pi * (angle / 180.0)
	return ((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * math.sin(t_0)) * math.cos(t_0)
function code(a, b, angle)
	t_0 = Float64(pi * Float64(angle / 180.0))
	return Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * sin(t_0)) * cos(t_0))
end
function tmp = code(a, b, angle)
	t_0 = pi * (angle / 180.0);
	tmp = ((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * sin(t_0)) * cos(t_0);
end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin t\_0\right) \cdot \cos t\_0
\end{array}
\end{array}

Alternative 1: 57.6% accurate, 1.0× speedup?

\[\begin{array}{l} b_m = \left|b\right| \\ angle_m = \left|angle\right| \\ angle_s = \mathsf{copysign}\left(1, angle\right) \\ \begin{array}{l} t_0 := \left(b\_m + a\right) \cdot \left(a - b\_m\right)\\ t_1 := \cos \left(angle\_m \cdot \frac{\pi}{-180}\right)\\ t_2 := \left(b\_m - a\right) \cdot \left(b\_m + a\right)\\ angle\_s \cdot \begin{array}{l} \mathbf{if}\;b\_m \leq 1.15 \cdot 10^{+22}:\\ \;\;\;\;2 \cdot \left(t\_2 \cdot \left(\sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(angle\_m \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right) \cdot \cos \left(\frac{\pi \cdot angle\_m}{-180}\right)\right)\right)\\ \mathbf{elif}\;b\_m \leq 10^{+209}:\\ \;\;\;\;2 \cdot \left(t\_2 \cdot \sin \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)\\ \mathbf{elif}\;b\_m \leq 2 \cdot 10^{+276}:\\ \;\;\;\;2 \cdot \left(t\_1 \cdot \left(\sin \left(angle\_m \cdot \frac{\sqrt[3]{{\pi}^{3}}}{-180}\right) \cdot t\_0\right)\right)\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(t\_1 \cdot \left(-0.005555555555555556 \cdot \left(angle\_m \cdot \left(\pi \cdot t\_0\right)\right)\right)\right)\\ \end{array} \end{array} \end{array} \]
b_m = (fabs.f64 b)
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b_m angle_m)
 :precision binary64
 (let* ((t_0 (* (+ b_m a) (- a b_m)))
        (t_1 (cos (* angle_m (/ PI -180.0))))
        (t_2 (* (- b_m a) (+ b_m a))))
   (*
    angle_s
    (if (<= b_m 1.15e+22)
      (*
       2.0
       (*
        t_2
        (*
         (sin (expm1 (log1p (* angle_m (* PI 0.005555555555555556)))))
         (cos (/ (* PI angle_m) -180.0)))))
      (if (<= b_m 1e+209)
        (* 2.0 (* t_2 (sin (* PI (* angle_m 0.005555555555555556)))))
        (if (<= b_m 2e+276)
          (*
           2.0
           (* t_1 (* (sin (* angle_m (/ (cbrt (pow PI 3.0)) -180.0))) t_0)))
          (*
           2.0
           (* t_1 (* -0.005555555555555556 (* angle_m (* PI t_0)))))))))))
b_m = fabs(b);
angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b_m, double angle_m) {
	double t_0 = (b_m + a) * (a - b_m);
	double t_1 = cos((angle_m * (((double) M_PI) / -180.0)));
	double t_2 = (b_m - a) * (b_m + a);
	double tmp;
	if (b_m <= 1.15e+22) {
		tmp = 2.0 * (t_2 * (sin(expm1(log1p((angle_m * (((double) M_PI) * 0.005555555555555556))))) * cos(((((double) M_PI) * angle_m) / -180.0))));
	} else if (b_m <= 1e+209) {
		tmp = 2.0 * (t_2 * sin((((double) M_PI) * (angle_m * 0.005555555555555556))));
	} else if (b_m <= 2e+276) {
		tmp = 2.0 * (t_1 * (sin((angle_m * (cbrt(pow(((double) M_PI), 3.0)) / -180.0))) * t_0));
	} else {
		tmp = 2.0 * (t_1 * (-0.005555555555555556 * (angle_m * (((double) M_PI) * t_0))));
	}
	return angle_s * tmp;
}
b_m = Math.abs(b);
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b_m, double angle_m) {
	double t_0 = (b_m + a) * (a - b_m);
	double t_1 = Math.cos((angle_m * (Math.PI / -180.0)));
	double t_2 = (b_m - a) * (b_m + a);
	double tmp;
	if (b_m <= 1.15e+22) {
		tmp = 2.0 * (t_2 * (Math.sin(Math.expm1(Math.log1p((angle_m * (Math.PI * 0.005555555555555556))))) * Math.cos(((Math.PI * angle_m) / -180.0))));
	} else if (b_m <= 1e+209) {
		tmp = 2.0 * (t_2 * Math.sin((Math.PI * (angle_m * 0.005555555555555556))));
	} else if (b_m <= 2e+276) {
		tmp = 2.0 * (t_1 * (Math.sin((angle_m * (Math.cbrt(Math.pow(Math.PI, 3.0)) / -180.0))) * t_0));
	} else {
		tmp = 2.0 * (t_1 * (-0.005555555555555556 * (angle_m * (Math.PI * t_0))));
	}
	return angle_s * tmp;
}
b_m = abs(b)
angle_m = abs(angle)
angle_s = copysign(1.0, angle)
function code(angle_s, a, b_m, angle_m)
	t_0 = Float64(Float64(b_m + a) * Float64(a - b_m))
	t_1 = cos(Float64(angle_m * Float64(pi / -180.0)))
	t_2 = Float64(Float64(b_m - a) * Float64(b_m + a))
	tmp = 0.0
	if (b_m <= 1.15e+22)
		tmp = Float64(2.0 * Float64(t_2 * Float64(sin(expm1(log1p(Float64(angle_m * Float64(pi * 0.005555555555555556))))) * cos(Float64(Float64(pi * angle_m) / -180.0)))));
	elseif (b_m <= 1e+209)
		tmp = Float64(2.0 * Float64(t_2 * sin(Float64(pi * Float64(angle_m * 0.005555555555555556)))));
	elseif (b_m <= 2e+276)
		tmp = Float64(2.0 * Float64(t_1 * Float64(sin(Float64(angle_m * Float64(cbrt((pi ^ 3.0)) / -180.0))) * t_0)));
	else
		tmp = Float64(2.0 * Float64(t_1 * Float64(-0.005555555555555556 * Float64(angle_m * Float64(pi * t_0)))));
	end
	return Float64(angle_s * tmp)
end
b_m = N[Abs[b], $MachinePrecision]
angle_m = N[Abs[angle], $MachinePrecision]
angle_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a_, b$95$m_, angle$95$m_] := Block[{t$95$0 = N[(N[(b$95$m + a), $MachinePrecision] * N[(a - b$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(angle$95$m * N[(Pi / -180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(b$95$m - a), $MachinePrecision] * N[(b$95$m + a), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[b$95$m, 1.15e+22], N[(2.0 * N[(t$95$2 * N[(N[Sin[N[(Exp[N[Log[1 + N[(angle$95$m * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[(Pi * angle$95$m), $MachinePrecision] / -180.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b$95$m, 1e+209], N[(2.0 * N[(t$95$2 * N[Sin[N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b$95$m, 2e+276], N[(2.0 * N[(t$95$1 * N[(N[Sin[N[(angle$95$m * N[(N[Power[N[Power[Pi, 3.0], $MachinePrecision], 1/3], $MachinePrecision] / -180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(t$95$1 * N[(-0.005555555555555556 * N[(angle$95$m * N[(Pi * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]]]]
\begin{array}{l}
b_m = \left|b\right|
\\
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)

\\
\begin{array}{l}
t_0 := \left(b\_m + a\right) \cdot \left(a - b\_m\right)\\
t_1 := \cos \left(angle\_m \cdot \frac{\pi}{-180}\right)\\
t_2 := \left(b\_m - a\right) \cdot \left(b\_m + a\right)\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;b\_m \leq 1.15 \cdot 10^{+22}:\\
\;\;\;\;2 \cdot \left(t\_2 \cdot \left(\sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(angle\_m \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right) \cdot \cos \left(\frac{\pi \cdot angle\_m}{-180}\right)\right)\right)\\

\mathbf{elif}\;b\_m \leq 10^{+209}:\\
\;\;\;\;2 \cdot \left(t\_2 \cdot \sin \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)\\

\mathbf{elif}\;b\_m \leq 2 \cdot 10^{+276}:\\
\;\;\;\;2 \cdot \left(t\_1 \cdot \left(\sin \left(angle\_m \cdot \frac{\sqrt[3]{{\pi}^{3}}}{-180}\right) \cdot t\_0\right)\right)\\

\mathbf{else}:\\
\;\;\;\;2 \cdot \left(t\_1 \cdot \left(-0.005555555555555556 \cdot \left(angle\_m \cdot \left(\pi \cdot t\_0\right)\right)\right)\right)\\


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if b < 1.1500000000000001e22

    1. Initial program 59.0%

      \[\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]
    2. Simplified59.5%

      \[\leadsto \color{blue}{2 \cdot \left(\left({b}^{2} - {a}^{2}\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. unpow259.5%

        \[\leadsto 2 \cdot \left(\left(\color{blue}{b \cdot b} - {a}^{2}\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      2. unpow259.5%

        \[\leadsto 2 \cdot \left(\left(b \cdot b - \color{blue}{a \cdot a}\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      3. difference-of-squares60.6%

        \[\leadsto 2 \cdot \left(\color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
    5. Applied egg-rr60.6%

      \[\leadsto 2 \cdot \left(\color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
    6. Step-by-step derivation
      1. div-inv61.8%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(\pi \cdot \color{blue}{\left(angle \cdot \frac{1}{180}\right)}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      2. metadata-eval61.8%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(\pi \cdot \left(angle \cdot \color{blue}{0.005555555555555556}\right)\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      3. expm1-log1p-u50.1%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)} \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      4. expm1-undefine20.0%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \color{blue}{\left(e^{\mathsf{log1p}\left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)} - 1\right)} \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      5. metadata-eval20.0%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(e^{\mathsf{log1p}\left(\pi \cdot \left(angle \cdot \color{blue}{\frac{1}{180}}\right)\right)} - 1\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      6. div-inv20.0%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(e^{\mathsf{log1p}\left(\pi \cdot \color{blue}{\frac{angle}{180}}\right)} - 1\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      7. associate-*r/20.0%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{\pi \cdot angle}{180}}\right)} - 1\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      8. *-commutative20.0%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{angle \cdot \pi}}{180}\right)} - 1\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      9. associate-/l*20.0%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(e^{\mathsf{log1p}\left(\color{blue}{angle \cdot \frac{\pi}{180}}\right)} - 1\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
    7. Applied egg-rr20.0%

      \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \color{blue}{\left(e^{\mathsf{log1p}\left(angle \cdot \frac{\pi}{180}\right)} - 1\right)} \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
    8. Step-by-step derivation
      1. expm1-define50.1%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(angle \cdot \frac{\pi}{180}\right)\right)\right)} \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      2. *-rgt-identity50.1%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(angle \cdot \frac{\color{blue}{\pi \cdot 1}}{180}\right)\right)\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      3. associate-/l*50.1%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(angle \cdot \color{blue}{\left(\pi \cdot \frac{1}{180}\right)}\right)\right)\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      4. metadata-eval50.1%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(angle \cdot \left(\pi \cdot \color{blue}{0.005555555555555556}\right)\right)\right)\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      5. associate-*l*50.1%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{\left(angle \cdot \pi\right) \cdot 0.005555555555555556}\right)\right)\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      6. *-commutative50.1%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{\left(\pi \cdot angle\right)} \cdot 0.005555555555555556\right)\right)\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      7. *-commutative50.1%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{0.005555555555555556 \cdot \left(\pi \cdot angle\right)}\right)\right)\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      8. associate-*r*50.1%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{\left(0.005555555555555556 \cdot \pi\right) \cdot angle}\right)\right)\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
    9. Simplified50.1%

      \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\right)\right)\right)} \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]

    if 1.1500000000000001e22 < b < 1.0000000000000001e209

    1. Initial program 40.2%

      \[\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]
    2. Simplified41.8%

      \[\leadsto \color{blue}{2 \cdot \left(\left({b}^{2} - {a}^{2}\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. unpow241.8%

        \[\leadsto 2 \cdot \left(\left(\color{blue}{b \cdot b} - {a}^{2}\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      2. unpow241.8%

        \[\leadsto 2 \cdot \left(\left(b \cdot b - \color{blue}{a \cdot a}\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      3. difference-of-squares49.2%

        \[\leadsto 2 \cdot \left(\color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
    5. Applied egg-rr49.2%

      \[\leadsto 2 \cdot \left(\color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
    6. Taylor expanded in angle around 0 59.7%

      \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \color{blue}{1}\right)\right) \]
    7. Taylor expanded in angle around inf 59.8%

      \[\leadsto 2 \cdot \color{blue}{\left(\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\right)} \]
    8. Step-by-step derivation
      1. associate-*r*62.2%

        \[\leadsto 2 \cdot \left(\sin \color{blue}{\left(\left(0.005555555555555556 \cdot angle\right) \cdot \pi\right)} \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\right) \]
    9. Simplified62.2%

      \[\leadsto 2 \cdot \color{blue}{\left(\sin \left(\left(0.005555555555555556 \cdot angle\right) \cdot \pi\right) \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\right)} \]

    if 1.0000000000000001e209 < b < 2.0000000000000001e276

    1. Initial program 36.8%

      \[\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]
    2. Simplified27.8%

      \[\leadsto \color{blue}{2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left({a}^{2} - {b}^{2}\right)\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. unpow227.8%

        \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\color{blue}{a \cdot a} - {b}^{2}\right)\right)\right) \]
      2. unpow227.8%

        \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(a \cdot a - \color{blue}{b \cdot b}\right)\right)\right) \]
      3. difference-of-squares55.7%

        \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \color{blue}{\left(\left(a + b\right) \cdot \left(a - b\right)\right)}\right)\right) \]
    5. Applied egg-rr55.7%

      \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \color{blue}{\left(\left(a + b\right) \cdot \left(a - b\right)\right)}\right)\right) \]
    6. Step-by-step derivation
      1. add-cbrt-cube82.9%

        \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\color{blue}{\sqrt[3]{\left(\pi \cdot \pi\right) \cdot \pi}}}{-180}\right) \cdot \left(\left(a + b\right) \cdot \left(a - b\right)\right)\right)\right) \]
      2. pow382.9%

        \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\sqrt[3]{\color{blue}{{\pi}^{3}}}}{-180}\right) \cdot \left(\left(a + b\right) \cdot \left(a - b\right)\right)\right)\right) \]
    7. Applied egg-rr82.9%

      \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\color{blue}{\sqrt[3]{{\pi}^{3}}}}{-180}\right) \cdot \left(\left(a + b\right) \cdot \left(a - b\right)\right)\right)\right) \]

    if 2.0000000000000001e276 < b

    1. Initial program 66.7%

      \[\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]
    2. Simplified66.7%

      \[\leadsto \color{blue}{2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left({a}^{2} - {b}^{2}\right)\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. unpow266.7%

        \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\color{blue}{a \cdot a} - {b}^{2}\right)\right)\right) \]
      2. unpow266.7%

        \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(a \cdot a - \color{blue}{b \cdot b}\right)\right)\right) \]
      3. difference-of-squares66.7%

        \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \color{blue}{\left(\left(a + b\right) \cdot \left(a - b\right)\right)}\right)\right) \]
    5. Applied egg-rr66.7%

      \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \color{blue}{\left(\left(a + b\right) \cdot \left(a - b\right)\right)}\right)\right) \]
    6. Taylor expanded in angle around 0 83.3%

      \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \color{blue}{\left(-0.005555555555555556 \cdot \left(angle \cdot \left(\pi \cdot \left(\left(a + b\right) \cdot \left(a - b\right)\right)\right)\right)\right)}\right) \]
  3. Recombined 4 regimes into one program.
  4. Final simplification54.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 1.15 \cdot 10^{+22}:\\ \;\;\;\;2 \cdot \left(\left(\left(b - a\right) \cdot \left(b + a\right)\right) \cdot \left(\sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right)\\ \mathbf{elif}\;b \leq 10^{+209}:\\ \;\;\;\;2 \cdot \left(\left(\left(b - a\right) \cdot \left(b + a\right)\right) \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\\ \mathbf{elif}\;b \leq 2 \cdot 10^{+276}:\\ \;\;\;\;2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\sqrt[3]{{\pi}^{3}}}{-180}\right) \cdot \left(\left(b + a\right) \cdot \left(a - b\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(-0.005555555555555556 \cdot \left(angle \cdot \left(\pi \cdot \left(\left(b + a\right) \cdot \left(a - b\right)\right)\right)\right)\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 57.8% accurate, 0.4× speedup?

\[\begin{array}{l} b_m = \left|b\right| \\ angle_m = \left|angle\right| \\ angle_s = \mathsf{copysign}\left(1, angle\right) \\ \begin{array}{l} t_0 := \pi \cdot \frac{angle\_m}{180}\\ t_1 := angle\_m \cdot \frac{\pi}{-180}\\ angle\_s \cdot \begin{array}{l} \mathbf{if}\;\left(\left(2 \cdot \left({b\_m}^{2} - {a}^{2}\right)\right) \cdot \sin t\_0\right) \cdot \cos t\_0 \leq -\infty:\\ \;\;\;\;2 \cdot \left(\cos t\_1 \cdot \left(\sin t\_1 \cdot \sqrt{{\left({a}^{2} - {b\_m}^{2}\right)}^{2}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(\left(\left(b\_m - a\right) \cdot \left(b\_m + a\right)\right) \cdot \left(\sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\_m\right)\right) \cdot \sqrt[3]{{\cos \left(angle\_m \cdot \frac{{\left(\sqrt{\pi}\right)}^{2}}{180}\right)}^{3}}\right)\right)\\ \end{array} \end{array} \end{array} \]
b_m = (fabs.f64 b)
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b_m angle_m)
 :precision binary64
 (let* ((t_0 (* PI (/ angle_m 180.0))) (t_1 (* angle_m (/ PI -180.0))))
   (*
    angle_s
    (if (<=
         (* (* (* 2.0 (- (pow b_m 2.0) (pow a 2.0))) (sin t_0)) (cos t_0))
         (- INFINITY))
      (*
       2.0
       (*
        (cos t_1)
        (* (sin t_1) (sqrt (pow (- (pow a 2.0) (pow b_m 2.0)) 2.0)))))
      (*
       2.0
       (*
        (* (- b_m a) (+ b_m a))
        (*
         (sin (* 0.005555555555555556 (* PI angle_m)))
         (cbrt
          (pow (cos (* angle_m (/ (pow (sqrt PI) 2.0) 180.0))) 3.0)))))))))
b_m = fabs(b);
angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b_m, double angle_m) {
	double t_0 = ((double) M_PI) * (angle_m / 180.0);
	double t_1 = angle_m * (((double) M_PI) / -180.0);
	double tmp;
	if ((((2.0 * (pow(b_m, 2.0) - pow(a, 2.0))) * sin(t_0)) * cos(t_0)) <= -((double) INFINITY)) {
		tmp = 2.0 * (cos(t_1) * (sin(t_1) * sqrt(pow((pow(a, 2.0) - pow(b_m, 2.0)), 2.0))));
	} else {
		tmp = 2.0 * (((b_m - a) * (b_m + a)) * (sin((0.005555555555555556 * (((double) M_PI) * angle_m))) * cbrt(pow(cos((angle_m * (pow(sqrt(((double) M_PI)), 2.0) / 180.0))), 3.0))));
	}
	return angle_s * tmp;
}
b_m = Math.abs(b);
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b_m, double angle_m) {
	double t_0 = Math.PI * (angle_m / 180.0);
	double t_1 = angle_m * (Math.PI / -180.0);
	double tmp;
	if ((((2.0 * (Math.pow(b_m, 2.0) - Math.pow(a, 2.0))) * Math.sin(t_0)) * Math.cos(t_0)) <= -Double.POSITIVE_INFINITY) {
		tmp = 2.0 * (Math.cos(t_1) * (Math.sin(t_1) * Math.sqrt(Math.pow((Math.pow(a, 2.0) - Math.pow(b_m, 2.0)), 2.0))));
	} else {
		tmp = 2.0 * (((b_m - a) * (b_m + a)) * (Math.sin((0.005555555555555556 * (Math.PI * angle_m))) * Math.cbrt(Math.pow(Math.cos((angle_m * (Math.pow(Math.sqrt(Math.PI), 2.0) / 180.0))), 3.0))));
	}
	return angle_s * tmp;
}
b_m = abs(b)
angle_m = abs(angle)
angle_s = copysign(1.0, angle)
function code(angle_s, a, b_m, angle_m)
	t_0 = Float64(pi * Float64(angle_m / 180.0))
	t_1 = Float64(angle_m * Float64(pi / -180.0))
	tmp = 0.0
	if (Float64(Float64(Float64(2.0 * Float64((b_m ^ 2.0) - (a ^ 2.0))) * sin(t_0)) * cos(t_0)) <= Float64(-Inf))
		tmp = Float64(2.0 * Float64(cos(t_1) * Float64(sin(t_1) * sqrt((Float64((a ^ 2.0) - (b_m ^ 2.0)) ^ 2.0)))));
	else
		tmp = Float64(2.0 * Float64(Float64(Float64(b_m - a) * Float64(b_m + a)) * Float64(sin(Float64(0.005555555555555556 * Float64(pi * angle_m))) * cbrt((cos(Float64(angle_m * Float64((sqrt(pi) ^ 2.0) / 180.0))) ^ 3.0)))));
	end
	return Float64(angle_s * tmp)
end
b_m = N[Abs[b], $MachinePrecision]
angle_m = N[Abs[angle], $MachinePrecision]
angle_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a_, b$95$m_, angle$95$m_] := Block[{t$95$0 = N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(angle$95$m * N[(Pi / -180.0), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[(N[(N[(2.0 * N[(N[Power[b$95$m, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], (-Infinity)], N[(2.0 * N[(N[Cos[t$95$1], $MachinePrecision] * N[(N[Sin[t$95$1], $MachinePrecision] * N[Sqrt[N[Power[N[(N[Power[a, 2.0], $MachinePrecision] - N[Power[b$95$m, 2.0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(N[(b$95$m - a), $MachinePrecision] * N[(b$95$m + a), $MachinePrecision]), $MachinePrecision] * N[(N[Sin[N[(0.005555555555555556 * N[(Pi * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Power[N[Power[N[Cos[N[(angle$95$m * N[(N[Power[N[Sqrt[Pi], $MachinePrecision], 2.0], $MachinePrecision] / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 3.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]]
\begin{array}{l}
b_m = \left|b\right|
\\
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)

\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle\_m}{180}\\
t_1 := angle\_m \cdot \frac{\pi}{-180}\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;\left(\left(2 \cdot \left({b\_m}^{2} - {a}^{2}\right)\right) \cdot \sin t\_0\right) \cdot \cos t\_0 \leq -\infty:\\
\;\;\;\;2 \cdot \left(\cos t\_1 \cdot \left(\sin t\_1 \cdot \sqrt{{\left({a}^{2} - {b\_m}^{2}\right)}^{2}}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\left(\left(b\_m - a\right) \cdot \left(b\_m + a\right)\right) \cdot \left(\sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\_m\right)\right) \cdot \sqrt[3]{{\cos \left(angle\_m \cdot \frac{{\left(\sqrt{\pi}\right)}^{2}}{180}\right)}^{3}}\right)\right)\\


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 (*.f64 2 (-.f64 (pow.f64 b 2) (pow.f64 a 2))) (sin.f64 (*.f64 (PI.f64) (/.f64 angle 180)))) (cos.f64 (*.f64 (PI.f64) (/.f64 angle 180)))) < -inf.0

    1. Initial program 50.6%

      \[\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]
    2. Simplified52.5%

      \[\leadsto \color{blue}{2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left({a}^{2} - {b}^{2}\right)\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt25.3%

        \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \color{blue}{\left(\sqrt{{a}^{2} - {b}^{2}} \cdot \sqrt{{a}^{2} - {b}^{2}}\right)}\right)\right) \]
      2. sqrt-unprod40.4%

        \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \color{blue}{\sqrt{\left({a}^{2} - {b}^{2}\right) \cdot \left({a}^{2} - {b}^{2}\right)}}\right)\right) \]
      3. pow240.4%

        \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \sqrt{\color{blue}{{\left({a}^{2} - {b}^{2}\right)}^{2}}}\right)\right) \]
    5. Applied egg-rr40.4%

      \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \color{blue}{\sqrt{{\left({a}^{2} - {b}^{2}\right)}^{2}}}\right)\right) \]

    if -inf.0 < (*.f64 (*.f64 (*.f64 2 (-.f64 (pow.f64 b 2) (pow.f64 a 2))) (sin.f64 (*.f64 (PI.f64) (/.f64 angle 180)))) (cos.f64 (*.f64 (PI.f64) (/.f64 angle 180))))

    1. Initial program 56.4%

      \[\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]
    2. Simplified56.8%

      \[\leadsto \color{blue}{2 \cdot \left(\left({b}^{2} - {a}^{2}\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. unpow256.8%

        \[\leadsto 2 \cdot \left(\left(\color{blue}{b \cdot b} - {a}^{2}\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      2. unpow256.8%

        \[\leadsto 2 \cdot \left(\left(b \cdot b - \color{blue}{a \cdot a}\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      3. difference-of-squares60.8%

        \[\leadsto 2 \cdot \left(\color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
    5. Applied egg-rr60.8%

      \[\leadsto 2 \cdot \left(\color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
    6. Step-by-step derivation
      1. *-commutative60.8%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\color{blue}{angle \cdot \pi}}{-180}\right)\right)\right) \]
      2. associate-*r/60.8%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \color{blue}{\left(angle \cdot \frac{\pi}{-180}\right)}\right)\right) \]
      3. add-cbrt-cube60.8%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \color{blue}{\sqrt[3]{\left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \cos \left(angle \cdot \frac{\pi}{-180}\right)\right) \cdot \cos \left(angle \cdot \frac{\pi}{-180}\right)}}\right)\right) \]
      4. pow360.8%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \sqrt[3]{\color{blue}{{\cos \left(angle \cdot \frac{\pi}{-180}\right)}^{3}}}\right)\right) \]
    7. Applied egg-rr60.8%

      \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \color{blue}{\sqrt[3]{{\cos \left(angle \cdot \frac{\pi}{180}\right)}^{3}}}\right)\right) \]
    8. Taylor expanded in angle around inf 60.4%

      \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\color{blue}{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)} \cdot \sqrt[3]{{\cos \left(angle \cdot \frac{\pi}{180}\right)}^{3}}\right)\right) \]
    9. Step-by-step derivation
      1. add-sqr-sqrt62.7%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \sqrt[3]{{\cos \left(angle \cdot \frac{\color{blue}{\sqrt{\pi} \cdot \sqrt{\pi}}}{180}\right)}^{3}}\right)\right) \]
      2. pow262.7%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \sqrt[3]{{\cos \left(angle \cdot \frac{\color{blue}{{\left(\sqrt{\pi}\right)}^{2}}}{180}\right)}^{3}}\right)\right) \]
    10. Applied egg-rr62.7%

      \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \sqrt[3]{{\cos \left(angle \cdot \frac{\color{blue}{{\left(\sqrt{\pi}\right)}^{2}}}{180}\right)}^{3}}\right)\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification58.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \leq -\infty:\\ \;\;\;\;2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \sqrt{{\left({a}^{2} - {b}^{2}\right)}^{2}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(\left(\left(b - a\right) \cdot \left(b + a\right)\right) \cdot \left(\sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right) \cdot \sqrt[3]{{\cos \left(angle \cdot \frac{{\left(\sqrt{\pi}\right)}^{2}}{180}\right)}^{3}}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 56.5% accurate, 0.4× speedup?

\[\begin{array}{l} b_m = \left|b\right| \\ angle_m = \left|angle\right| \\ angle_s = \mathsf{copysign}\left(1, angle\right) \\ \begin{array}{l} t_0 := \pi \cdot \frac{angle\_m}{180}\\ t_1 := \sin t\_0\\ t_2 := angle\_m \cdot \frac{\pi}{-180}\\ angle\_s \cdot \begin{array}{l} \mathbf{if}\;\left(\left(2 \cdot \left({b\_m}^{2} - {a}^{2}\right)\right) \cdot t\_1\right) \cdot \cos t\_0 \leq -\infty:\\ \;\;\;\;2 \cdot \left(\cos t\_2 \cdot \left(\sin t\_2 \cdot \sqrt{{\left({a}^{2} - {b\_m}^{2}\right)}^{2}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(t\_1 \cdot \left(\left(b\_m - a\right) \cdot \left(b\_m + a\right)\right)\right)\\ \end{array} \end{array} \end{array} \]
b_m = (fabs.f64 b)
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b_m angle_m)
 :precision binary64
 (let* ((t_0 (* PI (/ angle_m 180.0)))
        (t_1 (sin t_0))
        (t_2 (* angle_m (/ PI -180.0))))
   (*
    angle_s
    (if (<=
         (* (* (* 2.0 (- (pow b_m 2.0) (pow a 2.0))) t_1) (cos t_0))
         (- INFINITY))
      (*
       2.0
       (*
        (cos t_2)
        (* (sin t_2) (sqrt (pow (- (pow a 2.0) (pow b_m 2.0)) 2.0)))))
      (* 2.0 (* t_1 (* (- b_m a) (+ b_m a))))))))
b_m = fabs(b);
angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b_m, double angle_m) {
	double t_0 = ((double) M_PI) * (angle_m / 180.0);
	double t_1 = sin(t_0);
	double t_2 = angle_m * (((double) M_PI) / -180.0);
	double tmp;
	if ((((2.0 * (pow(b_m, 2.0) - pow(a, 2.0))) * t_1) * cos(t_0)) <= -((double) INFINITY)) {
		tmp = 2.0 * (cos(t_2) * (sin(t_2) * sqrt(pow((pow(a, 2.0) - pow(b_m, 2.0)), 2.0))));
	} else {
		tmp = 2.0 * (t_1 * ((b_m - a) * (b_m + a)));
	}
	return angle_s * tmp;
}
b_m = Math.abs(b);
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b_m, double angle_m) {
	double t_0 = Math.PI * (angle_m / 180.0);
	double t_1 = Math.sin(t_0);
	double t_2 = angle_m * (Math.PI / -180.0);
	double tmp;
	if ((((2.0 * (Math.pow(b_m, 2.0) - Math.pow(a, 2.0))) * t_1) * Math.cos(t_0)) <= -Double.POSITIVE_INFINITY) {
		tmp = 2.0 * (Math.cos(t_2) * (Math.sin(t_2) * Math.sqrt(Math.pow((Math.pow(a, 2.0) - Math.pow(b_m, 2.0)), 2.0))));
	} else {
		tmp = 2.0 * (t_1 * ((b_m - a) * (b_m + a)));
	}
	return angle_s * tmp;
}
b_m = math.fabs(b)
angle_m = math.fabs(angle)
angle_s = math.copysign(1.0, angle)
def code(angle_s, a, b_m, angle_m):
	t_0 = math.pi * (angle_m / 180.0)
	t_1 = math.sin(t_0)
	t_2 = angle_m * (math.pi / -180.0)
	tmp = 0
	if (((2.0 * (math.pow(b_m, 2.0) - math.pow(a, 2.0))) * t_1) * math.cos(t_0)) <= -math.inf:
		tmp = 2.0 * (math.cos(t_2) * (math.sin(t_2) * math.sqrt(math.pow((math.pow(a, 2.0) - math.pow(b_m, 2.0)), 2.0))))
	else:
		tmp = 2.0 * (t_1 * ((b_m - a) * (b_m + a)))
	return angle_s * tmp
b_m = abs(b)
angle_m = abs(angle)
angle_s = copysign(1.0, angle)
function code(angle_s, a, b_m, angle_m)
	t_0 = Float64(pi * Float64(angle_m / 180.0))
	t_1 = sin(t_0)
	t_2 = Float64(angle_m * Float64(pi / -180.0))
	tmp = 0.0
	if (Float64(Float64(Float64(2.0 * Float64((b_m ^ 2.0) - (a ^ 2.0))) * t_1) * cos(t_0)) <= Float64(-Inf))
		tmp = Float64(2.0 * Float64(cos(t_2) * Float64(sin(t_2) * sqrt((Float64((a ^ 2.0) - (b_m ^ 2.0)) ^ 2.0)))));
	else
		tmp = Float64(2.0 * Float64(t_1 * Float64(Float64(b_m - a) * Float64(b_m + a))));
	end
	return Float64(angle_s * tmp)
end
b_m = abs(b);
angle_m = abs(angle);
angle_s = sign(angle) * abs(1.0);
function tmp_2 = code(angle_s, a, b_m, angle_m)
	t_0 = pi * (angle_m / 180.0);
	t_1 = sin(t_0);
	t_2 = angle_m * (pi / -180.0);
	tmp = 0.0;
	if ((((2.0 * ((b_m ^ 2.0) - (a ^ 2.0))) * t_1) * cos(t_0)) <= -Inf)
		tmp = 2.0 * (cos(t_2) * (sin(t_2) * sqrt((((a ^ 2.0) - (b_m ^ 2.0)) ^ 2.0))));
	else
		tmp = 2.0 * (t_1 * ((b_m - a) * (b_m + a)));
	end
	tmp_2 = angle_s * tmp;
end
b_m = N[Abs[b], $MachinePrecision]
angle_m = N[Abs[angle], $MachinePrecision]
angle_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a_, b$95$m_, angle$95$m_] := Block[{t$95$0 = N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sin[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[(angle$95$m * N[(Pi / -180.0), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[(N[(N[(2.0 * N[(N[Power[b$95$m, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], (-Infinity)], N[(2.0 * N[(N[Cos[t$95$2], $MachinePrecision] * N[(N[Sin[t$95$2], $MachinePrecision] * N[Sqrt[N[Power[N[(N[Power[a, 2.0], $MachinePrecision] - N[Power[b$95$m, 2.0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(t$95$1 * N[(N[(b$95$m - a), $MachinePrecision] * N[(b$95$m + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]]]
\begin{array}{l}
b_m = \left|b\right|
\\
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)

\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle\_m}{180}\\
t_1 := \sin t\_0\\
t_2 := angle\_m \cdot \frac{\pi}{-180}\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;\left(\left(2 \cdot \left({b\_m}^{2} - {a}^{2}\right)\right) \cdot t\_1\right) \cdot \cos t\_0 \leq -\infty:\\
\;\;\;\;2 \cdot \left(\cos t\_2 \cdot \left(\sin t\_2 \cdot \sqrt{{\left({a}^{2} - {b\_m}^{2}\right)}^{2}}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;2 \cdot \left(t\_1 \cdot \left(\left(b\_m - a\right) \cdot \left(b\_m + a\right)\right)\right)\\


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 (*.f64 2 (-.f64 (pow.f64 b 2) (pow.f64 a 2))) (sin.f64 (*.f64 (PI.f64) (/.f64 angle 180)))) (cos.f64 (*.f64 (PI.f64) (/.f64 angle 180)))) < -inf.0

    1. Initial program 50.6%

      \[\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]
    2. Simplified52.5%

      \[\leadsto \color{blue}{2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left({a}^{2} - {b}^{2}\right)\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt25.3%

        \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \color{blue}{\left(\sqrt{{a}^{2} - {b}^{2}} \cdot \sqrt{{a}^{2} - {b}^{2}}\right)}\right)\right) \]
      2. sqrt-unprod40.4%

        \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \color{blue}{\sqrt{\left({a}^{2} - {b}^{2}\right) \cdot \left({a}^{2} - {b}^{2}\right)}}\right)\right) \]
      3. pow240.4%

        \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \sqrt{\color{blue}{{\left({a}^{2} - {b}^{2}\right)}^{2}}}\right)\right) \]
    5. Applied egg-rr40.4%

      \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \color{blue}{\sqrt{{\left({a}^{2} - {b}^{2}\right)}^{2}}}\right)\right) \]

    if -inf.0 < (*.f64 (*.f64 (*.f64 2 (-.f64 (pow.f64 b 2) (pow.f64 a 2))) (sin.f64 (*.f64 (PI.f64) (/.f64 angle 180)))) (cos.f64 (*.f64 (PI.f64) (/.f64 angle 180))))

    1. Initial program 56.4%

      \[\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]
    2. Simplified56.8%

      \[\leadsto \color{blue}{2 \cdot \left(\left({b}^{2} - {a}^{2}\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. unpow256.8%

        \[\leadsto 2 \cdot \left(\left(\color{blue}{b \cdot b} - {a}^{2}\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      2. unpow256.8%

        \[\leadsto 2 \cdot \left(\left(b \cdot b - \color{blue}{a \cdot a}\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      3. difference-of-squares60.8%

        \[\leadsto 2 \cdot \left(\color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
    5. Applied egg-rr60.8%

      \[\leadsto 2 \cdot \left(\color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
    6. Taylor expanded in angle around 0 63.2%

      \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \color{blue}{1}\right)\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification58.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \leq -\infty:\\ \;\;\;\;2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \sqrt{{\left({a}^{2} - {b}^{2}\right)}^{2}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \left(\left(b - a\right) \cdot \left(b + a\right)\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 57.4% accurate, 1.0× speedup?

\[\begin{array}{l} b_m = \left|b\right| \\ angle_m = \left|angle\right| \\ angle_s = \mathsf{copysign}\left(1, angle\right) \\ \begin{array}{l} t_0 := \left(b\_m - a\right) \cdot \left(b\_m + a\right)\\ angle\_s \cdot \begin{array}{l} \mathbf{if}\;b\_m \leq 2.25 \cdot 10^{+23}:\\ \;\;\;\;2 \cdot \left(t\_0 \cdot \left(\sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(angle\_m \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right) \cdot \cos \left(\frac{\pi \cdot angle\_m}{-180}\right)\right)\right)\\ \mathbf{elif}\;b\_m \leq 4 \cdot 10^{+244}:\\ \;\;\;\;2 \cdot \left(t\_0 \cdot \sin \left(\frac{1}{\frac{180}{\pi \cdot angle\_m}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(angle\_m \cdot \left(\pi \cdot \left(\left(b\_m + a\right) \cdot \left(a - b\_m\right)\right)\right)\right) \cdot -0.011111111111111112\\ \end{array} \end{array} \end{array} \]
b_m = (fabs.f64 b)
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b_m angle_m)
 :precision binary64
 (let* ((t_0 (* (- b_m a) (+ b_m a))))
   (*
    angle_s
    (if (<= b_m 2.25e+23)
      (*
       2.0
       (*
        t_0
        (*
         (sin (expm1 (log1p (* angle_m (* PI 0.005555555555555556)))))
         (cos (/ (* PI angle_m) -180.0)))))
      (if (<= b_m 4e+244)
        (* 2.0 (* t_0 (sin (/ 1.0 (/ 180.0 (* PI angle_m))))))
        (*
         (* angle_m (* PI (* (+ b_m a) (- a b_m))))
         -0.011111111111111112))))))
b_m = fabs(b);
angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b_m, double angle_m) {
	double t_0 = (b_m - a) * (b_m + a);
	double tmp;
	if (b_m <= 2.25e+23) {
		tmp = 2.0 * (t_0 * (sin(expm1(log1p((angle_m * (((double) M_PI) * 0.005555555555555556))))) * cos(((((double) M_PI) * angle_m) / -180.0))));
	} else if (b_m <= 4e+244) {
		tmp = 2.0 * (t_0 * sin((1.0 / (180.0 / (((double) M_PI) * angle_m)))));
	} else {
		tmp = (angle_m * (((double) M_PI) * ((b_m + a) * (a - b_m)))) * -0.011111111111111112;
	}
	return angle_s * tmp;
}
b_m = Math.abs(b);
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b_m, double angle_m) {
	double t_0 = (b_m - a) * (b_m + a);
	double tmp;
	if (b_m <= 2.25e+23) {
		tmp = 2.0 * (t_0 * (Math.sin(Math.expm1(Math.log1p((angle_m * (Math.PI * 0.005555555555555556))))) * Math.cos(((Math.PI * angle_m) / -180.0))));
	} else if (b_m <= 4e+244) {
		tmp = 2.0 * (t_0 * Math.sin((1.0 / (180.0 / (Math.PI * angle_m)))));
	} else {
		tmp = (angle_m * (Math.PI * ((b_m + a) * (a - b_m)))) * -0.011111111111111112;
	}
	return angle_s * tmp;
}
b_m = math.fabs(b)
angle_m = math.fabs(angle)
angle_s = math.copysign(1.0, angle)
def code(angle_s, a, b_m, angle_m):
	t_0 = (b_m - a) * (b_m + a)
	tmp = 0
	if b_m <= 2.25e+23:
		tmp = 2.0 * (t_0 * (math.sin(math.expm1(math.log1p((angle_m * (math.pi * 0.005555555555555556))))) * math.cos(((math.pi * angle_m) / -180.0))))
	elif b_m <= 4e+244:
		tmp = 2.0 * (t_0 * math.sin((1.0 / (180.0 / (math.pi * angle_m)))))
	else:
		tmp = (angle_m * (math.pi * ((b_m + a) * (a - b_m)))) * -0.011111111111111112
	return angle_s * tmp
b_m = abs(b)
angle_m = abs(angle)
angle_s = copysign(1.0, angle)
function code(angle_s, a, b_m, angle_m)
	t_0 = Float64(Float64(b_m - a) * Float64(b_m + a))
	tmp = 0.0
	if (b_m <= 2.25e+23)
		tmp = Float64(2.0 * Float64(t_0 * Float64(sin(expm1(log1p(Float64(angle_m * Float64(pi * 0.005555555555555556))))) * cos(Float64(Float64(pi * angle_m) / -180.0)))));
	elseif (b_m <= 4e+244)
		tmp = Float64(2.0 * Float64(t_0 * sin(Float64(1.0 / Float64(180.0 / Float64(pi * angle_m))))));
	else
		tmp = Float64(Float64(angle_m * Float64(pi * Float64(Float64(b_m + a) * Float64(a - b_m)))) * -0.011111111111111112);
	end
	return Float64(angle_s * tmp)
end
b_m = N[Abs[b], $MachinePrecision]
angle_m = N[Abs[angle], $MachinePrecision]
angle_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a_, b$95$m_, angle$95$m_] := Block[{t$95$0 = N[(N[(b$95$m - a), $MachinePrecision] * N[(b$95$m + a), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[b$95$m, 2.25e+23], N[(2.0 * N[(t$95$0 * N[(N[Sin[N[(Exp[N[Log[1 + N[(angle$95$m * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[(Pi * angle$95$m), $MachinePrecision] / -180.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b$95$m, 4e+244], N[(2.0 * N[(t$95$0 * N[Sin[N[(1.0 / N[(180.0 / N[(Pi * angle$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(angle$95$m * N[(Pi * N[(N[(b$95$m + a), $MachinePrecision] * N[(a - b$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.011111111111111112), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
b_m = \left|b\right|
\\
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)

\\
\begin{array}{l}
t_0 := \left(b\_m - a\right) \cdot \left(b\_m + a\right)\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;b\_m \leq 2.25 \cdot 10^{+23}:\\
\;\;\;\;2 \cdot \left(t\_0 \cdot \left(\sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(angle\_m \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right) \cdot \cos \left(\frac{\pi \cdot angle\_m}{-180}\right)\right)\right)\\

\mathbf{elif}\;b\_m \leq 4 \cdot 10^{+244}:\\
\;\;\;\;2 \cdot \left(t\_0 \cdot \sin \left(\frac{1}{\frac{180}{\pi \cdot angle\_m}}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\left(angle\_m \cdot \left(\pi \cdot \left(\left(b\_m + a\right) \cdot \left(a - b\_m\right)\right)\right)\right) \cdot -0.011111111111111112\\


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < 2.2499999999999999e23

    1. Initial program 59.0%

      \[\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]
    2. Simplified59.5%

      \[\leadsto \color{blue}{2 \cdot \left(\left({b}^{2} - {a}^{2}\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. unpow259.5%

        \[\leadsto 2 \cdot \left(\left(\color{blue}{b \cdot b} - {a}^{2}\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      2. unpow259.5%

        \[\leadsto 2 \cdot \left(\left(b \cdot b - \color{blue}{a \cdot a}\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      3. difference-of-squares60.6%

        \[\leadsto 2 \cdot \left(\color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
    5. Applied egg-rr60.6%

      \[\leadsto 2 \cdot \left(\color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
    6. Step-by-step derivation
      1. div-inv61.8%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(\pi \cdot \color{blue}{\left(angle \cdot \frac{1}{180}\right)}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      2. metadata-eval61.8%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(\pi \cdot \left(angle \cdot \color{blue}{0.005555555555555556}\right)\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      3. expm1-log1p-u50.1%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)} \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      4. expm1-undefine20.0%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \color{blue}{\left(e^{\mathsf{log1p}\left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)} - 1\right)} \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      5. metadata-eval20.0%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(e^{\mathsf{log1p}\left(\pi \cdot \left(angle \cdot \color{blue}{\frac{1}{180}}\right)\right)} - 1\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      6. div-inv20.0%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(e^{\mathsf{log1p}\left(\pi \cdot \color{blue}{\frac{angle}{180}}\right)} - 1\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      7. associate-*r/20.0%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{\pi \cdot angle}{180}}\right)} - 1\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      8. *-commutative20.0%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{angle \cdot \pi}}{180}\right)} - 1\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      9. associate-/l*20.0%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(e^{\mathsf{log1p}\left(\color{blue}{angle \cdot \frac{\pi}{180}}\right)} - 1\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
    7. Applied egg-rr20.0%

      \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \color{blue}{\left(e^{\mathsf{log1p}\left(angle \cdot \frac{\pi}{180}\right)} - 1\right)} \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
    8. Step-by-step derivation
      1. expm1-define50.1%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(angle \cdot \frac{\pi}{180}\right)\right)\right)} \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      2. *-rgt-identity50.1%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(angle \cdot \frac{\color{blue}{\pi \cdot 1}}{180}\right)\right)\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      3. associate-/l*50.1%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(angle \cdot \color{blue}{\left(\pi \cdot \frac{1}{180}\right)}\right)\right)\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      4. metadata-eval50.1%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(angle \cdot \left(\pi \cdot \color{blue}{0.005555555555555556}\right)\right)\right)\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      5. associate-*l*50.1%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{\left(angle \cdot \pi\right) \cdot 0.005555555555555556}\right)\right)\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      6. *-commutative50.1%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{\left(\pi \cdot angle\right)} \cdot 0.005555555555555556\right)\right)\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      7. *-commutative50.1%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{0.005555555555555556 \cdot \left(\pi \cdot angle\right)}\right)\right)\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      8. associate-*r*50.1%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{\left(0.005555555555555556 \cdot \pi\right) \cdot angle}\right)\right)\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
    9. Simplified50.1%

      \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\right)\right)\right)} \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]

    if 2.2499999999999999e23 < b < 4.0000000000000003e244

    1. Initial program 37.4%

      \[\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]
    2. Simplified38.7%

      \[\leadsto \color{blue}{2 \cdot \left(\left({b}^{2} - {a}^{2}\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. unpow238.7%

        \[\leadsto 2 \cdot \left(\left(\color{blue}{b \cdot b} - {a}^{2}\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      2. unpow238.7%

        \[\leadsto 2 \cdot \left(\left(b \cdot b - \color{blue}{a \cdot a}\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      3. difference-of-squares51.6%

        \[\leadsto 2 \cdot \left(\color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
    5. Applied egg-rr51.6%

      \[\leadsto 2 \cdot \left(\color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
    6. Taylor expanded in angle around 0 62.8%

      \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \color{blue}{1}\right)\right) \]
    7. Step-by-step derivation
      1. associate-*r/64.6%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \color{blue}{\left(\frac{\pi \cdot angle}{180}\right)} \cdot 1\right)\right) \]
      2. clear-num61.4%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \color{blue}{\left(\frac{1}{\frac{180}{\pi \cdot angle}}\right)} \cdot 1\right)\right) \]
    8. Applied egg-rr61.4%

      \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \color{blue}{\left(\frac{1}{\frac{180}{\pi \cdot angle}}\right)} \cdot 1\right)\right) \]

    if 4.0000000000000003e244 < b

    1. Initial program 63.6%

      \[\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]
    2. Simplified54.5%

      \[\leadsto \color{blue}{2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left({a}^{2} - {b}^{2}\right)\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. unpow254.5%

        \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\color{blue}{a \cdot a} - {b}^{2}\right)\right)\right) \]
      2. unpow254.5%

        \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(a \cdot a - \color{blue}{b \cdot b}\right)\right)\right) \]
      3. difference-of-squares55.2%

        \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \color{blue}{\left(\left(a + b\right) \cdot \left(a - b\right)\right)}\right)\right) \]
    5. Applied egg-rr55.2%

      \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \color{blue}{\left(\left(a + b\right) \cdot \left(a - b\right)\right)}\right)\right) \]
    6. Taylor expanded in angle around 0 55.2%

      \[\leadsto 2 \cdot \left(\color{blue}{1} \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\left(a + b\right) \cdot \left(a - b\right)\right)\right)\right) \]
    7. Taylor expanded in angle around 0 64.3%

      \[\leadsto \color{blue}{-0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \left(\left(a + b\right) \cdot \left(a - b\right)\right)\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification52.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 2.25 \cdot 10^{+23}:\\ \;\;\;\;2 \cdot \left(\left(\left(b - a\right) \cdot \left(b + a\right)\right) \cdot \left(\sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right)\\ \mathbf{elif}\;b \leq 4 \cdot 10^{+244}:\\ \;\;\;\;2 \cdot \left(\left(\left(b - a\right) \cdot \left(b + a\right)\right) \cdot \sin \left(\frac{1}{\frac{180}{\pi \cdot angle}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(angle \cdot \left(\pi \cdot \left(\left(b + a\right) \cdot \left(a - b\right)\right)\right)\right) \cdot -0.011111111111111112\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 56.5% accurate, 1.9× speedup?

\[\begin{array}{l} b_m = \left|b\right| \\ angle_m = \left|angle\right| \\ angle_s = \mathsf{copysign}\left(1, angle\right) \\ angle\_s \cdot \begin{array}{l} \mathbf{if}\;{a}^{2} \leq 2 \cdot 10^{+178}:\\ \;\;\;\;2 \cdot \left(\left(\left(b\_m - a\right) \cdot \left(b\_m + a\right)\right) \cdot \sin \left(\frac{1}{\frac{180}{\pi \cdot angle\_m}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(\left(\left(b\_m + a\right) \cdot \left(a - b\_m\right)\right) \cdot \left(\pi \cdot \left(angle\_m \cdot -0.005555555555555556\right)\right)\right)\\ \end{array} \end{array} \]
b_m = (fabs.f64 b)
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b_m angle_m)
 :precision binary64
 (*
  angle_s
  (if (<= (pow a 2.0) 2e+178)
    (* 2.0 (* (* (- b_m a) (+ b_m a)) (sin (/ 1.0 (/ 180.0 (* PI angle_m))))))
    (*
     2.0
     (* (* (+ b_m a) (- a b_m)) (* PI (* angle_m -0.005555555555555556)))))))
b_m = fabs(b);
angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b_m, double angle_m) {
	double tmp;
	if (pow(a, 2.0) <= 2e+178) {
		tmp = 2.0 * (((b_m - a) * (b_m + a)) * sin((1.0 / (180.0 / (((double) M_PI) * angle_m)))));
	} else {
		tmp = 2.0 * (((b_m + a) * (a - b_m)) * (((double) M_PI) * (angle_m * -0.005555555555555556)));
	}
	return angle_s * tmp;
}
b_m = Math.abs(b);
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b_m, double angle_m) {
	double tmp;
	if (Math.pow(a, 2.0) <= 2e+178) {
		tmp = 2.0 * (((b_m - a) * (b_m + a)) * Math.sin((1.0 / (180.0 / (Math.PI * angle_m)))));
	} else {
		tmp = 2.0 * (((b_m + a) * (a - b_m)) * (Math.PI * (angle_m * -0.005555555555555556)));
	}
	return angle_s * tmp;
}
b_m = math.fabs(b)
angle_m = math.fabs(angle)
angle_s = math.copysign(1.0, angle)
def code(angle_s, a, b_m, angle_m):
	tmp = 0
	if math.pow(a, 2.0) <= 2e+178:
		tmp = 2.0 * (((b_m - a) * (b_m + a)) * math.sin((1.0 / (180.0 / (math.pi * angle_m)))))
	else:
		tmp = 2.0 * (((b_m + a) * (a - b_m)) * (math.pi * (angle_m * -0.005555555555555556)))
	return angle_s * tmp
b_m = abs(b)
angle_m = abs(angle)
angle_s = copysign(1.0, angle)
function code(angle_s, a, b_m, angle_m)
	tmp = 0.0
	if ((a ^ 2.0) <= 2e+178)
		tmp = Float64(2.0 * Float64(Float64(Float64(b_m - a) * Float64(b_m + a)) * sin(Float64(1.0 / Float64(180.0 / Float64(pi * angle_m))))));
	else
		tmp = Float64(2.0 * Float64(Float64(Float64(b_m + a) * Float64(a - b_m)) * Float64(pi * Float64(angle_m * -0.005555555555555556))));
	end
	return Float64(angle_s * tmp)
end
b_m = abs(b);
angle_m = abs(angle);
angle_s = sign(angle) * abs(1.0);
function tmp_2 = code(angle_s, a, b_m, angle_m)
	tmp = 0.0;
	if ((a ^ 2.0) <= 2e+178)
		tmp = 2.0 * (((b_m - a) * (b_m + a)) * sin((1.0 / (180.0 / (pi * angle_m)))));
	else
		tmp = 2.0 * (((b_m + a) * (a - b_m)) * (pi * (angle_m * -0.005555555555555556)));
	end
	tmp_2 = angle_s * tmp;
end
b_m = N[Abs[b], $MachinePrecision]
angle_m = N[Abs[angle], $MachinePrecision]
angle_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a_, b$95$m_, angle$95$m_] := N[(angle$95$s * If[LessEqual[N[Power[a, 2.0], $MachinePrecision], 2e+178], N[(2.0 * N[(N[(N[(b$95$m - a), $MachinePrecision] * N[(b$95$m + a), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(1.0 / N[(180.0 / N[(Pi * angle$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(N[(b$95$m + a), $MachinePrecision] * N[(a - b$95$m), $MachinePrecision]), $MachinePrecision] * N[(Pi * N[(angle$95$m * -0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)

\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;{a}^{2} \leq 2 \cdot 10^{+178}:\\
\;\;\;\;2 \cdot \left(\left(\left(b\_m - a\right) \cdot \left(b\_m + a\right)\right) \cdot \sin \left(\frac{1}{\frac{180}{\pi \cdot angle\_m}}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\left(\left(b\_m + a\right) \cdot \left(a - b\_m\right)\right) \cdot \left(\pi \cdot \left(angle\_m \cdot -0.005555555555555556\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (pow.f64 a 2) < 2.0000000000000001e178

    1. Initial program 62.8%

      \[\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]
    2. Simplified62.5%

      \[\leadsto \color{blue}{2 \cdot \left(\left({b}^{2} - {a}^{2}\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. unpow262.5%

        \[\leadsto 2 \cdot \left(\left(\color{blue}{b \cdot b} - {a}^{2}\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      2. unpow262.5%

        \[\leadsto 2 \cdot \left(\left(b \cdot b - \color{blue}{a \cdot a}\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      3. difference-of-squares62.5%

        \[\leadsto 2 \cdot \left(\color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
    5. Applied egg-rr62.5%

      \[\leadsto 2 \cdot \left(\color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
    6. Taylor expanded in angle around 0 62.5%

      \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \color{blue}{1}\right)\right) \]
    7. Step-by-step derivation
      1. associate-*r/62.4%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \color{blue}{\left(\frac{\pi \cdot angle}{180}\right)} \cdot 1\right)\right) \]
      2. clear-num64.0%

        \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \color{blue}{\left(\frac{1}{\frac{180}{\pi \cdot angle}}\right)} \cdot 1\right)\right) \]
    8. Applied egg-rr64.0%

      \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \color{blue}{\left(\frac{1}{\frac{180}{\pi \cdot angle}}\right)} \cdot 1\right)\right) \]

    if 2.0000000000000001e178 < (pow.f64 a 2)

    1. Initial program 40.5%

      \[\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]
    2. Simplified43.6%

      \[\leadsto \color{blue}{2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left({a}^{2} - {b}^{2}\right)\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. unpow243.6%

        \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\color{blue}{a \cdot a} - {b}^{2}\right)\right)\right) \]
      2. unpow243.6%

        \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(a \cdot a - \color{blue}{b \cdot b}\right)\right)\right) \]
      3. difference-of-squares53.0%

        \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \color{blue}{\left(\left(a + b\right) \cdot \left(a - b\right)\right)}\right)\right) \]
    5. Applied egg-rr53.0%

      \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \color{blue}{\left(\left(a + b\right) \cdot \left(a - b\right)\right)}\right)\right) \]
    6. Taylor expanded in angle around 0 54.0%

      \[\leadsto 2 \cdot \left(\color{blue}{1} \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\left(a + b\right) \cdot \left(a - b\right)\right)\right)\right) \]
    7. Taylor expanded in angle around 0 61.3%

      \[\leadsto 2 \cdot \left(1 \cdot \left(\color{blue}{\left(-0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)} \cdot \left(\left(a + b\right) \cdot \left(a - b\right)\right)\right)\right) \]
    8. Step-by-step derivation
      1. associate-*r*61.4%

        \[\leadsto 2 \cdot \left(1 \cdot \left(\color{blue}{\left(\left(-0.005555555555555556 \cdot angle\right) \cdot \pi\right)} \cdot \left(\left(a + b\right) \cdot \left(a - b\right)\right)\right)\right) \]
    9. Simplified61.4%

      \[\leadsto 2 \cdot \left(1 \cdot \left(\color{blue}{\left(\left(-0.005555555555555556 \cdot angle\right) \cdot \pi\right)} \cdot \left(\left(a + b\right) \cdot \left(a - b\right)\right)\right)\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification63.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;{a}^{2} \leq 2 \cdot 10^{+178}:\\ \;\;\;\;2 \cdot \left(\left(\left(b - a\right) \cdot \left(b + a\right)\right) \cdot \sin \left(\frac{1}{\frac{180}{\pi \cdot angle}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(\left(\left(b + a\right) \cdot \left(a - b\right)\right) \cdot \left(\pi \cdot \left(angle \cdot -0.005555555555555556\right)\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 56.7% accurate, 1.9× speedup?

\[\begin{array}{l} b_m = \left|b\right| \\ angle_m = \left|angle\right| \\ angle_s = \mathsf{copysign}\left(1, angle\right) \\ angle\_s \cdot \begin{array}{l} \mathbf{if}\;{a}^{2} \leq 10^{+292}:\\ \;\;\;\;2 \cdot \left(\left(\left(b\_m - a\right) \cdot \left(b\_m + a\right)\right) \cdot \sin \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(angle\_m \cdot \left(\pi \cdot \left(\left(b\_m + a\right) \cdot \left(a - b\_m\right)\right)\right)\right) \cdot -0.011111111111111112\\ \end{array} \end{array} \]
b_m = (fabs.f64 b)
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b_m angle_m)
 :precision binary64
 (*
  angle_s
  (if (<= (pow a 2.0) 1e+292)
    (*
     2.0
     (* (* (- b_m a) (+ b_m a)) (sin (* PI (* angle_m 0.005555555555555556)))))
    (* (* angle_m (* PI (* (+ b_m a) (- a b_m)))) -0.011111111111111112))))
b_m = fabs(b);
angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b_m, double angle_m) {
	double tmp;
	if (pow(a, 2.0) <= 1e+292) {
		tmp = 2.0 * (((b_m - a) * (b_m + a)) * sin((((double) M_PI) * (angle_m * 0.005555555555555556))));
	} else {
		tmp = (angle_m * (((double) M_PI) * ((b_m + a) * (a - b_m)))) * -0.011111111111111112;
	}
	return angle_s * tmp;
}
b_m = Math.abs(b);
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b_m, double angle_m) {
	double tmp;
	if (Math.pow(a, 2.0) <= 1e+292) {
		tmp = 2.0 * (((b_m - a) * (b_m + a)) * Math.sin((Math.PI * (angle_m * 0.005555555555555556))));
	} else {
		tmp = (angle_m * (Math.PI * ((b_m + a) * (a - b_m)))) * -0.011111111111111112;
	}
	return angle_s * tmp;
}
b_m = math.fabs(b)
angle_m = math.fabs(angle)
angle_s = math.copysign(1.0, angle)
def code(angle_s, a, b_m, angle_m):
	tmp = 0
	if math.pow(a, 2.0) <= 1e+292:
		tmp = 2.0 * (((b_m - a) * (b_m + a)) * math.sin((math.pi * (angle_m * 0.005555555555555556))))
	else:
		tmp = (angle_m * (math.pi * ((b_m + a) * (a - b_m)))) * -0.011111111111111112
	return angle_s * tmp
b_m = abs(b)
angle_m = abs(angle)
angle_s = copysign(1.0, angle)
function code(angle_s, a, b_m, angle_m)
	tmp = 0.0
	if ((a ^ 2.0) <= 1e+292)
		tmp = Float64(2.0 * Float64(Float64(Float64(b_m - a) * Float64(b_m + a)) * sin(Float64(pi * Float64(angle_m * 0.005555555555555556)))));
	else
		tmp = Float64(Float64(angle_m * Float64(pi * Float64(Float64(b_m + a) * Float64(a - b_m)))) * -0.011111111111111112);
	end
	return Float64(angle_s * tmp)
end
b_m = abs(b);
angle_m = abs(angle);
angle_s = sign(angle) * abs(1.0);
function tmp_2 = code(angle_s, a, b_m, angle_m)
	tmp = 0.0;
	if ((a ^ 2.0) <= 1e+292)
		tmp = 2.0 * (((b_m - a) * (b_m + a)) * sin((pi * (angle_m * 0.005555555555555556))));
	else
		tmp = (angle_m * (pi * ((b_m + a) * (a - b_m)))) * -0.011111111111111112;
	end
	tmp_2 = angle_s * tmp;
end
b_m = N[Abs[b], $MachinePrecision]
angle_m = N[Abs[angle], $MachinePrecision]
angle_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a_, b$95$m_, angle$95$m_] := N[(angle$95$s * If[LessEqual[N[Power[a, 2.0], $MachinePrecision], 1e+292], N[(2.0 * N[(N[(N[(b$95$m - a), $MachinePrecision] * N[(b$95$m + a), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(angle$95$m * N[(Pi * N[(N[(b$95$m + a), $MachinePrecision] * N[(a - b$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.011111111111111112), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)

\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;{a}^{2} \leq 10^{+292}:\\
\;\;\;\;2 \cdot \left(\left(\left(b\_m - a\right) \cdot \left(b\_m + a\right)\right) \cdot \sin \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\left(angle\_m \cdot \left(\pi \cdot \left(\left(b\_m + a\right) \cdot \left(a - b\_m\right)\right)\right)\right) \cdot -0.011111111111111112\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (pow.f64 a 2) < 1e292

    1. Initial program 60.6%

      \[\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]
    2. Simplified60.4%

      \[\leadsto \color{blue}{2 \cdot \left(\left({b}^{2} - {a}^{2}\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. unpow260.4%

        \[\leadsto 2 \cdot \left(\left(\color{blue}{b \cdot b} - {a}^{2}\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      2. unpow260.4%

        \[\leadsto 2 \cdot \left(\left(b \cdot b - \color{blue}{a \cdot a}\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
      3. difference-of-squares60.4%

        \[\leadsto 2 \cdot \left(\color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
    5. Applied egg-rr60.4%

      \[\leadsto 2 \cdot \left(\color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
    6. Taylor expanded in angle around 0 62.5%

      \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \color{blue}{1}\right)\right) \]
    7. Taylor expanded in angle around inf 60.8%

      \[\leadsto 2 \cdot \color{blue}{\left(\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\right)} \]
    8. Step-by-step derivation
      1. associate-*r*62.9%

        \[\leadsto 2 \cdot \left(\sin \color{blue}{\left(\left(0.005555555555555556 \cdot angle\right) \cdot \pi\right)} \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\right) \]
    9. Simplified62.9%

      \[\leadsto 2 \cdot \color{blue}{\left(\sin \left(\left(0.005555555555555556 \cdot angle\right) \cdot \pi\right) \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\right)} \]

    if 1e292 < (pow.f64 a 2)

    1. Initial program 39.5%

      \[\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]
    2. Simplified42.6%

      \[\leadsto \color{blue}{2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left({a}^{2} - {b}^{2}\right)\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. unpow242.6%

        \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\color{blue}{a \cdot a} - {b}^{2}\right)\right)\right) \]
      2. unpow242.6%

        \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(a \cdot a - \color{blue}{b \cdot b}\right)\right)\right) \]
      3. difference-of-squares55.2%

        \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \color{blue}{\left(\left(a + b\right) \cdot \left(a - b\right)\right)}\right)\right) \]
    5. Applied egg-rr55.2%

      \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \color{blue}{\left(\left(a + b\right) \cdot \left(a - b\right)\right)}\right)\right) \]
    6. Taylor expanded in angle around 0 53.6%

      \[\leadsto 2 \cdot \left(\color{blue}{1} \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\left(a + b\right) \cdot \left(a - b\right)\right)\right)\right) \]
    7. Taylor expanded in angle around 0 62.9%

      \[\leadsto \color{blue}{-0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \left(\left(a + b\right) \cdot \left(a - b\right)\right)\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification62.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;{a}^{2} \leq 10^{+292}:\\ \;\;\;\;2 \cdot \left(\left(\left(b - a\right) \cdot \left(b + a\right)\right) \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(angle \cdot \left(\pi \cdot \left(\left(b + a\right) \cdot \left(a - b\right)\right)\right)\right) \cdot -0.011111111111111112\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 56.8% accurate, 3.6× speedup?

\[\begin{array}{l} b_m = \left|b\right| \\ angle_m = \left|angle\right| \\ angle_s = \mathsf{copysign}\left(1, angle\right) \\ angle\_s \cdot \left(2 \cdot \left(\sin \left(\pi \cdot \frac{angle\_m}{180}\right) \cdot \left(\left(b\_m - a\right) \cdot \left(b\_m + a\right)\right)\right)\right) \end{array} \]
b_m = (fabs.f64 b)
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b_m angle_m)
 :precision binary64
 (*
  angle_s
  (* 2.0 (* (sin (* PI (/ angle_m 180.0))) (* (- b_m a) (+ b_m a))))))
b_m = fabs(b);
angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b_m, double angle_m) {
	return angle_s * (2.0 * (sin((((double) M_PI) * (angle_m / 180.0))) * ((b_m - a) * (b_m + a))));
}
b_m = Math.abs(b);
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b_m, double angle_m) {
	return angle_s * (2.0 * (Math.sin((Math.PI * (angle_m / 180.0))) * ((b_m - a) * (b_m + a))));
}
b_m = math.fabs(b)
angle_m = math.fabs(angle)
angle_s = math.copysign(1.0, angle)
def code(angle_s, a, b_m, angle_m):
	return angle_s * (2.0 * (math.sin((math.pi * (angle_m / 180.0))) * ((b_m - a) * (b_m + a))))
b_m = abs(b)
angle_m = abs(angle)
angle_s = copysign(1.0, angle)
function code(angle_s, a, b_m, angle_m)
	return Float64(angle_s * Float64(2.0 * Float64(sin(Float64(pi * Float64(angle_m / 180.0))) * Float64(Float64(b_m - a) * Float64(b_m + a)))))
end
b_m = abs(b);
angle_m = abs(angle);
angle_s = sign(angle) * abs(1.0);
function tmp = code(angle_s, a, b_m, angle_m)
	tmp = angle_s * (2.0 * (sin((pi * (angle_m / 180.0))) * ((b_m - a) * (b_m + a))));
end
b_m = N[Abs[b], $MachinePrecision]
angle_m = N[Abs[angle], $MachinePrecision]
angle_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a_, b$95$m_, angle$95$m_] := N[(angle$95$s * N[(2.0 * N[(N[Sin[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(b$95$m - a), $MachinePrecision] * N[(b$95$m + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)

\\
angle\_s \cdot \left(2 \cdot \left(\sin \left(\pi \cdot \frac{angle\_m}{180}\right) \cdot \left(\left(b\_m - a\right) \cdot \left(b\_m + a\right)\right)\right)\right)
\end{array}
Derivation
  1. Initial program 55.2%

    \[\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]
  2. Simplified55.9%

    \[\leadsto \color{blue}{2 \cdot \left(\left({b}^{2} - {a}^{2}\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right)} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. unpow255.9%

      \[\leadsto 2 \cdot \left(\left(\color{blue}{b \cdot b} - {a}^{2}\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
    2. unpow255.9%

      \[\leadsto 2 \cdot \left(\left(b \cdot b - \color{blue}{a \cdot a}\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
    3. difference-of-squares59.1%

      \[\leadsto 2 \cdot \left(\color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
  5. Applied egg-rr59.1%

    \[\leadsto 2 \cdot \left(\color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{\pi \cdot angle}{-180}\right)\right)\right) \]
  6. Taylor expanded in angle around 0 61.4%

    \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \color{blue}{1}\right)\right) \]
  7. Final simplification61.4%

    \[\leadsto 2 \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \left(\left(b - a\right) \cdot \left(b + a\right)\right)\right) \]
  8. Add Preprocessing

Alternative 8: 55.1% accurate, 27.9× speedup?

\[\begin{array}{l} b_m = \left|b\right| \\ angle_m = \left|angle\right| \\ angle_s = \mathsf{copysign}\left(1, angle\right) \\ angle\_s \cdot \left(2 \cdot \left(\left(\left(b\_m + a\right) \cdot \left(a - b\_m\right)\right) \cdot \left(\pi \cdot \left(angle\_m \cdot -0.005555555555555556\right)\right)\right)\right) \end{array} \]
b_m = (fabs.f64 b)
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b_m angle_m)
 :precision binary64
 (*
  angle_s
  (*
   2.0
   (* (* (+ b_m a) (- a b_m)) (* PI (* angle_m -0.005555555555555556))))))
b_m = fabs(b);
angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b_m, double angle_m) {
	return angle_s * (2.0 * (((b_m + a) * (a - b_m)) * (((double) M_PI) * (angle_m * -0.005555555555555556))));
}
b_m = Math.abs(b);
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b_m, double angle_m) {
	return angle_s * (2.0 * (((b_m + a) * (a - b_m)) * (Math.PI * (angle_m * -0.005555555555555556))));
}
b_m = math.fabs(b)
angle_m = math.fabs(angle)
angle_s = math.copysign(1.0, angle)
def code(angle_s, a, b_m, angle_m):
	return angle_s * (2.0 * (((b_m + a) * (a - b_m)) * (math.pi * (angle_m * -0.005555555555555556))))
b_m = abs(b)
angle_m = abs(angle)
angle_s = copysign(1.0, angle)
function code(angle_s, a, b_m, angle_m)
	return Float64(angle_s * Float64(2.0 * Float64(Float64(Float64(b_m + a) * Float64(a - b_m)) * Float64(pi * Float64(angle_m * -0.005555555555555556)))))
end
b_m = abs(b);
angle_m = abs(angle);
angle_s = sign(angle) * abs(1.0);
function tmp = code(angle_s, a, b_m, angle_m)
	tmp = angle_s * (2.0 * (((b_m + a) * (a - b_m)) * (pi * (angle_m * -0.005555555555555556))));
end
b_m = N[Abs[b], $MachinePrecision]
angle_m = N[Abs[angle], $MachinePrecision]
angle_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a_, b$95$m_, angle$95$m_] := N[(angle$95$s * N[(2.0 * N[(N[(N[(b$95$m + a), $MachinePrecision] * N[(a - b$95$m), $MachinePrecision]), $MachinePrecision] * N[(Pi * N[(angle$95$m * -0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)

\\
angle\_s \cdot \left(2 \cdot \left(\left(\left(b\_m + a\right) \cdot \left(a - b\_m\right)\right) \cdot \left(\pi \cdot \left(angle\_m \cdot -0.005555555555555556\right)\right)\right)\right)
\end{array}
Derivation
  1. Initial program 55.2%

    \[\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]
  2. Simplified54.7%

    \[\leadsto \color{blue}{2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left({a}^{2} - {b}^{2}\right)\right)\right)} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. unpow254.7%

      \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\color{blue}{a \cdot a} - {b}^{2}\right)\right)\right) \]
    2. unpow254.7%

      \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(a \cdot a - \color{blue}{b \cdot b}\right)\right)\right) \]
    3. difference-of-squares57.9%

      \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \color{blue}{\left(\left(a + b\right) \cdot \left(a - b\right)\right)}\right)\right) \]
  5. Applied egg-rr57.9%

    \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \color{blue}{\left(\left(a + b\right) \cdot \left(a - b\right)\right)}\right)\right) \]
  6. Taylor expanded in angle around 0 58.9%

    \[\leadsto 2 \cdot \left(\color{blue}{1} \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\left(a + b\right) \cdot \left(a - b\right)\right)\right)\right) \]
  7. Taylor expanded in angle around 0 59.9%

    \[\leadsto 2 \cdot \left(1 \cdot \left(\color{blue}{\left(-0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)} \cdot \left(\left(a + b\right) \cdot \left(a - b\right)\right)\right)\right) \]
  8. Step-by-step derivation
    1. associate-*r*59.9%

      \[\leadsto 2 \cdot \left(1 \cdot \left(\color{blue}{\left(\left(-0.005555555555555556 \cdot angle\right) \cdot \pi\right)} \cdot \left(\left(a + b\right) \cdot \left(a - b\right)\right)\right)\right) \]
  9. Simplified59.9%

    \[\leadsto 2 \cdot \left(1 \cdot \left(\color{blue}{\left(\left(-0.005555555555555556 \cdot angle\right) \cdot \pi\right)} \cdot \left(\left(a + b\right) \cdot \left(a - b\right)\right)\right)\right) \]
  10. Final simplification59.9%

    \[\leadsto 2 \cdot \left(\left(\left(b + a\right) \cdot \left(a - b\right)\right) \cdot \left(\pi \cdot \left(angle \cdot -0.005555555555555556\right)\right)\right) \]
  11. Add Preprocessing

Alternative 9: 55.1% accurate, 32.2× speedup?

\[\begin{array}{l} b_m = \left|b\right| \\ angle_m = \left|angle\right| \\ angle_s = \mathsf{copysign}\left(1, angle\right) \\ angle\_s \cdot \left(\left(angle\_m \cdot \left(\pi \cdot \left(\left(b\_m + a\right) \cdot \left(a - b\_m\right)\right)\right)\right) \cdot -0.011111111111111112\right) \end{array} \]
b_m = (fabs.f64 b)
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b_m angle_m)
 :precision binary64
 (*
  angle_s
  (* (* angle_m (* PI (* (+ b_m a) (- a b_m)))) -0.011111111111111112)))
b_m = fabs(b);
angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b_m, double angle_m) {
	return angle_s * ((angle_m * (((double) M_PI) * ((b_m + a) * (a - b_m)))) * -0.011111111111111112);
}
b_m = Math.abs(b);
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b_m, double angle_m) {
	return angle_s * ((angle_m * (Math.PI * ((b_m + a) * (a - b_m)))) * -0.011111111111111112);
}
b_m = math.fabs(b)
angle_m = math.fabs(angle)
angle_s = math.copysign(1.0, angle)
def code(angle_s, a, b_m, angle_m):
	return angle_s * ((angle_m * (math.pi * ((b_m + a) * (a - b_m)))) * -0.011111111111111112)
b_m = abs(b)
angle_m = abs(angle)
angle_s = copysign(1.0, angle)
function code(angle_s, a, b_m, angle_m)
	return Float64(angle_s * Float64(Float64(angle_m * Float64(pi * Float64(Float64(b_m + a) * Float64(a - b_m)))) * -0.011111111111111112))
end
b_m = abs(b);
angle_m = abs(angle);
angle_s = sign(angle) * abs(1.0);
function tmp = code(angle_s, a, b_m, angle_m)
	tmp = angle_s * ((angle_m * (pi * ((b_m + a) * (a - b_m)))) * -0.011111111111111112);
end
b_m = N[Abs[b], $MachinePrecision]
angle_m = N[Abs[angle], $MachinePrecision]
angle_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a_, b$95$m_, angle$95$m_] := N[(angle$95$s * N[(N[(angle$95$m * N[(Pi * N[(N[(b$95$m + a), $MachinePrecision] * N[(a - b$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.011111111111111112), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)

\\
angle\_s \cdot \left(\left(angle\_m \cdot \left(\pi \cdot \left(\left(b\_m + a\right) \cdot \left(a - b\_m\right)\right)\right)\right) \cdot -0.011111111111111112\right)
\end{array}
Derivation
  1. Initial program 55.2%

    \[\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]
  2. Simplified54.7%

    \[\leadsto \color{blue}{2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left({a}^{2} - {b}^{2}\right)\right)\right)} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. unpow254.7%

      \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\color{blue}{a \cdot a} - {b}^{2}\right)\right)\right) \]
    2. unpow254.7%

      \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(a \cdot a - \color{blue}{b \cdot b}\right)\right)\right) \]
    3. difference-of-squares57.9%

      \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \color{blue}{\left(\left(a + b\right) \cdot \left(a - b\right)\right)}\right)\right) \]
  5. Applied egg-rr57.9%

    \[\leadsto 2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \color{blue}{\left(\left(a + b\right) \cdot \left(a - b\right)\right)}\right)\right) \]
  6. Taylor expanded in angle around 0 58.9%

    \[\leadsto 2 \cdot \left(\color{blue}{1} \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\left(a + b\right) \cdot \left(a - b\right)\right)\right)\right) \]
  7. Taylor expanded in angle around 0 59.9%

    \[\leadsto \color{blue}{-0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \left(\left(a + b\right) \cdot \left(a - b\right)\right)\right)\right)} \]
  8. Final simplification59.9%

    \[\leadsto \left(angle \cdot \left(\pi \cdot \left(\left(b + a\right) \cdot \left(a - b\right)\right)\right)\right) \cdot -0.011111111111111112 \]
  9. Add Preprocessing

Reproduce

?
herbie shell --seed 2024046 
(FPCore (a b angle)
  :name "ab-angle->ABCF B"
  :precision binary64
  (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin (* PI (/ angle 180.0)))) (cos (* PI (/ angle 180.0)))))