ab-angle->ABCF B

Percentage Accurate: 53.8% → 57.4%
Time: 39.5s
Alternatives: 13
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 13 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: 53.8% 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.4% accurate, 0.8× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ angle_s = \mathsf{copysign}\left(1, angle\right) \\ \begin{array}{l} t_0 := \sqrt{\pi \cdot angle_m}\\ t_1 := 2 \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\\ angle_s \cdot \begin{array}{l} \mathbf{if}\;{a}^{2} \leq 5 \cdot 10^{+109}:\\ \;\;\;\;\left(t_1 \cdot \sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\pi \cdot \left(angle_m \cdot 0.005555555555555556\right)\right)\right)\right)\right) \cdot \cos \left(\pi \cdot \frac{angle_m}{180}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(t_1 \cdot \sin \left(\frac{t_0}{\frac{180}{t_0}}\right)\right) \cdot \cos \left(\frac{\pi}{\frac{180}{angle_m}}\right)\\ \end{array} \end{array} \end{array} \]
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b angle_m)
 :precision binary64
 (let* ((t_0 (sqrt (* PI angle_m))) (t_1 (* 2.0 (* (+ a b) (- b a)))))
   (*
    angle_s
    (if (<= (pow a 2.0) 5e+109)
      (*
       (* t_1 (sin (expm1 (log1p (* PI (* angle_m 0.005555555555555556))))))
       (cos (* PI (/ angle_m 180.0))))
      (*
       (* t_1 (sin (/ t_0 (/ 180.0 t_0))))
       (cos (/ PI (/ 180.0 angle_m))))))))
angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
	double t_0 = sqrt((((double) M_PI) * angle_m));
	double t_1 = 2.0 * ((a + b) * (b - a));
	double tmp;
	if (pow(a, 2.0) <= 5e+109) {
		tmp = (t_1 * sin(expm1(log1p((((double) M_PI) * (angle_m * 0.005555555555555556)))))) * cos((((double) M_PI) * (angle_m / 180.0)));
	} else {
		tmp = (t_1 * sin((t_0 / (180.0 / t_0)))) * cos((((double) M_PI) / (180.0 / angle_m)));
	}
	return angle_s * tmp;
}
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
	double t_0 = Math.sqrt((Math.PI * angle_m));
	double t_1 = 2.0 * ((a + b) * (b - a));
	double tmp;
	if (Math.pow(a, 2.0) <= 5e+109) {
		tmp = (t_1 * Math.sin(Math.expm1(Math.log1p((Math.PI * (angle_m * 0.005555555555555556)))))) * Math.cos((Math.PI * (angle_m / 180.0)));
	} else {
		tmp = (t_1 * Math.sin((t_0 / (180.0 / t_0)))) * Math.cos((Math.PI / (180.0 / angle_m)));
	}
	return angle_s * tmp;
}
angle_m = math.fabs(angle)
angle_s = math.copysign(1.0, angle)
def code(angle_s, a, b, angle_m):
	t_0 = math.sqrt((math.pi * angle_m))
	t_1 = 2.0 * ((a + b) * (b - a))
	tmp = 0
	if math.pow(a, 2.0) <= 5e+109:
		tmp = (t_1 * math.sin(math.expm1(math.log1p((math.pi * (angle_m * 0.005555555555555556)))))) * math.cos((math.pi * (angle_m / 180.0)))
	else:
		tmp = (t_1 * math.sin((t_0 / (180.0 / t_0)))) * math.cos((math.pi / (180.0 / angle_m)))
	return angle_s * tmp
angle_m = abs(angle)
angle_s = copysign(1.0, angle)
function code(angle_s, a, b, angle_m)
	t_0 = sqrt(Float64(pi * angle_m))
	t_1 = Float64(2.0 * Float64(Float64(a + b) * Float64(b - a)))
	tmp = 0.0
	if ((a ^ 2.0) <= 5e+109)
		tmp = Float64(Float64(t_1 * sin(expm1(log1p(Float64(pi * Float64(angle_m * 0.005555555555555556)))))) * cos(Float64(pi * Float64(angle_m / 180.0))));
	else
		tmp = Float64(Float64(t_1 * sin(Float64(t_0 / Float64(180.0 / t_0)))) * cos(Float64(pi / Float64(180.0 / angle_m))));
	end
	return Float64(angle_s * tmp)
end
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_, angle$95$m_] := Block[{t$95$0 = N[Sqrt[N[(Pi * angle$95$m), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[(N[(a + b), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[Power[a, 2.0], $MachinePrecision], 5e+109], N[(N[(t$95$1 * N[Sin[N[(Exp[N[Log[1 + N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 * N[Sin[N[(t$95$0 / N[(180.0 / t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(Pi / N[(180.0 / angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)

\\
\begin{array}{l}
t_0 := \sqrt{\pi \cdot angle_m}\\
t_1 := 2 \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\\
angle_s \cdot \begin{array}{l}
\mathbf{if}\;{a}^{2} \leq 5 \cdot 10^{+109}:\\
\;\;\;\;\left(t_1 \cdot \sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\pi \cdot \left(angle_m \cdot 0.005555555555555556\right)\right)\right)\right)\right) \cdot \cos \left(\pi \cdot \frac{angle_m}{180}\right)\\

\mathbf{else}:\\
\;\;\;\;\left(t_1 \cdot \sin \left(\frac{t_0}{\frac{180}{t_0}}\right)\right) \cdot \cos \left(\frac{\pi}{\frac{180}{angle_m}}\right)\\


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

    1. Initial program 59.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. Add Preprocessing
    3. Step-by-step derivation
      1. unpow259.6%

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

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

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

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

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

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

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

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

    if 5.0000000000000001e109 < (pow.f64 a 2)

    1. Initial program 37.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. Add Preprocessing
    3. Step-by-step derivation
      1. unpow237.0%

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

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

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

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

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

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

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

      \[\leadsto \left(\left(2 \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)\right) \cdot \sin \color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)}\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]
    7. Step-by-step derivation
      1. clear-num42.6%

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 57.5% accurate, 0.8× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ angle_s = \mathsf{copysign}\left(1, angle\right) \\ \begin{array}{l} t_0 := \frac{\pi}{\frac{180}{angle_m}}\\ t_1 := 2 \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\\ angle_s \cdot \begin{array}{l} \mathbf{if}\;{a}^{2} \leq 10^{+244}:\\ \;\;\;\;\left(t_1 \cdot \sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\pi \cdot \left(angle_m \cdot 0.005555555555555556\right)\right)\right)\right)\right) \cdot \cos \left(\pi \cdot \frac{angle_m}{180}\right)\\ \mathbf{else}:\\ \;\;\;\;\cos t_0 \cdot \left(t_1 \cdot \sin t_0\right)\\ \end{array} \end{array} \end{array} \]
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b angle_m)
 :precision binary64
 (let* ((t_0 (/ PI (/ 180.0 angle_m))) (t_1 (* 2.0 (* (+ a b) (- b a)))))
   (*
    angle_s
    (if (<= (pow a 2.0) 1e+244)
      (*
       (* t_1 (sin (expm1 (log1p (* PI (* angle_m 0.005555555555555556))))))
       (cos (* PI (/ angle_m 180.0))))
      (* (cos t_0) (* t_1 (sin t_0)))))))
angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
	double t_0 = ((double) M_PI) / (180.0 / angle_m);
	double t_1 = 2.0 * ((a + b) * (b - a));
	double tmp;
	if (pow(a, 2.0) <= 1e+244) {
		tmp = (t_1 * sin(expm1(log1p((((double) M_PI) * (angle_m * 0.005555555555555556)))))) * cos((((double) M_PI) * (angle_m / 180.0)));
	} else {
		tmp = cos(t_0) * (t_1 * sin(t_0));
	}
	return angle_s * tmp;
}
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
	double t_0 = Math.PI / (180.0 / angle_m);
	double t_1 = 2.0 * ((a + b) * (b - a));
	double tmp;
	if (Math.pow(a, 2.0) <= 1e+244) {
		tmp = (t_1 * Math.sin(Math.expm1(Math.log1p((Math.PI * (angle_m * 0.005555555555555556)))))) * Math.cos((Math.PI * (angle_m / 180.0)));
	} else {
		tmp = Math.cos(t_0) * (t_1 * Math.sin(t_0));
	}
	return angle_s * tmp;
}
angle_m = math.fabs(angle)
angle_s = math.copysign(1.0, angle)
def code(angle_s, a, b, angle_m):
	t_0 = math.pi / (180.0 / angle_m)
	t_1 = 2.0 * ((a + b) * (b - a))
	tmp = 0
	if math.pow(a, 2.0) <= 1e+244:
		tmp = (t_1 * math.sin(math.expm1(math.log1p((math.pi * (angle_m * 0.005555555555555556)))))) * math.cos((math.pi * (angle_m / 180.0)))
	else:
		tmp = math.cos(t_0) * (t_1 * math.sin(t_0))
	return angle_s * tmp
angle_m = abs(angle)
angle_s = copysign(1.0, angle)
function code(angle_s, a, b, angle_m)
	t_0 = Float64(pi / Float64(180.0 / angle_m))
	t_1 = Float64(2.0 * Float64(Float64(a + b) * Float64(b - a)))
	tmp = 0.0
	if ((a ^ 2.0) <= 1e+244)
		tmp = Float64(Float64(t_1 * sin(expm1(log1p(Float64(pi * Float64(angle_m * 0.005555555555555556)))))) * cos(Float64(pi * Float64(angle_m / 180.0))));
	else
		tmp = Float64(cos(t_0) * Float64(t_1 * sin(t_0)));
	end
	return Float64(angle_s * tmp)
end
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_, angle$95$m_] := Block[{t$95$0 = N[(Pi / N[(180.0 / angle$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[(N[(a + b), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[Power[a, 2.0], $MachinePrecision], 1e+244], N[(N[(t$95$1 * N[Sin[N[(Exp[N[Log[1 + N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[t$95$0], $MachinePrecision] * N[(t$95$1 * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)

\\
\begin{array}{l}
t_0 := \frac{\pi}{\frac{180}{angle_m}}\\
t_1 := 2 \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\\
angle_s \cdot \begin{array}{l}
\mathbf{if}\;{a}^{2} \leq 10^{+244}:\\
\;\;\;\;\left(t_1 \cdot \sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\pi \cdot \left(angle_m \cdot 0.005555555555555556\right)\right)\right)\right)\right) \cdot \cos \left(\pi \cdot \frac{angle_m}{180}\right)\\

\mathbf{else}:\\
\;\;\;\;\cos t_0 \cdot \left(t_1 \cdot \sin t_0\right)\\


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

    1. Initial program 58.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. Add Preprocessing
    3. Step-by-step derivation
      1. unpow258.8%

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

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

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

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

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

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

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

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

    if 1.00000000000000007e244 < (pow.f64 a 2)

    1. Initial program 32.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. Add Preprocessing
    3. Step-by-step derivation
      1. unpow232.7%

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

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

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

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

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

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

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

      \[\leadsto \left(\left(2 \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)\right) \cdot \sin \color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)}\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]
    7. Step-by-step derivation
      1. clear-num40.4%

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

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

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

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

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

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

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

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

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

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

Alternative 3: 57.6% accurate, 1.0× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ angle_s = \mathsf{copysign}\left(1, angle\right) \\ \begin{array}{l} t_0 := 2 \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\\ t_1 := \frac{\pi}{\frac{180}{angle_m}}\\ t_2 := \cos t_1\\ angle_s \cdot \begin{array}{l} \mathbf{if}\;\frac{angle_m}{180} \leq 2 \cdot 10^{+70}:\\ \;\;\;\;t_2 \cdot \left(t_0 \cdot \sin t_1\right)\\ \mathbf{else}:\\ \;\;\;\;t_2 \cdot \left(t_0 \cdot \sin \left(e^{\log \left(\pi \cdot \left(angle_m \cdot 0.005555555555555556\right)\right)}\right)\right)\\ \end{array} \end{array} \end{array} \]
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b angle_m)
 :precision binary64
 (let* ((t_0 (* 2.0 (* (+ a b) (- b a))))
        (t_1 (/ PI (/ 180.0 angle_m)))
        (t_2 (cos t_1)))
   (*
    angle_s
    (if (<= (/ angle_m 180.0) 2e+70)
      (* t_2 (* t_0 (sin t_1)))
      (*
       t_2
       (* t_0 (sin (exp (log (* PI (* angle_m 0.005555555555555556)))))))))))
angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
	double t_0 = 2.0 * ((a + b) * (b - a));
	double t_1 = ((double) M_PI) / (180.0 / angle_m);
	double t_2 = cos(t_1);
	double tmp;
	if ((angle_m / 180.0) <= 2e+70) {
		tmp = t_2 * (t_0 * sin(t_1));
	} else {
		tmp = t_2 * (t_0 * sin(exp(log((((double) M_PI) * (angle_m * 0.005555555555555556))))));
	}
	return angle_s * tmp;
}
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
	double t_0 = 2.0 * ((a + b) * (b - a));
	double t_1 = Math.PI / (180.0 / angle_m);
	double t_2 = Math.cos(t_1);
	double tmp;
	if ((angle_m / 180.0) <= 2e+70) {
		tmp = t_2 * (t_0 * Math.sin(t_1));
	} else {
		tmp = t_2 * (t_0 * Math.sin(Math.exp(Math.log((Math.PI * (angle_m * 0.005555555555555556))))));
	}
	return angle_s * tmp;
}
angle_m = math.fabs(angle)
angle_s = math.copysign(1.0, angle)
def code(angle_s, a, b, angle_m):
	t_0 = 2.0 * ((a + b) * (b - a))
	t_1 = math.pi / (180.0 / angle_m)
	t_2 = math.cos(t_1)
	tmp = 0
	if (angle_m / 180.0) <= 2e+70:
		tmp = t_2 * (t_0 * math.sin(t_1))
	else:
		tmp = t_2 * (t_0 * math.sin(math.exp(math.log((math.pi * (angle_m * 0.005555555555555556))))))
	return angle_s * tmp
angle_m = abs(angle)
angle_s = copysign(1.0, angle)
function code(angle_s, a, b, angle_m)
	t_0 = Float64(2.0 * Float64(Float64(a + b) * Float64(b - a)))
	t_1 = Float64(pi / Float64(180.0 / angle_m))
	t_2 = cos(t_1)
	tmp = 0.0
	if (Float64(angle_m / 180.0) <= 2e+70)
		tmp = Float64(t_2 * Float64(t_0 * sin(t_1)));
	else
		tmp = Float64(t_2 * Float64(t_0 * sin(exp(log(Float64(pi * Float64(angle_m * 0.005555555555555556)))))));
	end
	return Float64(angle_s * tmp)
end
angle_m = abs(angle);
angle_s = sign(angle) * abs(1.0);
function tmp_2 = code(angle_s, a, b, angle_m)
	t_0 = 2.0 * ((a + b) * (b - a));
	t_1 = pi / (180.0 / angle_m);
	t_2 = cos(t_1);
	tmp = 0.0;
	if ((angle_m / 180.0) <= 2e+70)
		tmp = t_2 * (t_0 * sin(t_1));
	else
		tmp = t_2 * (t_0 * sin(exp(log((pi * (angle_m * 0.005555555555555556))))));
	end
	tmp_2 = angle_s * tmp;
end
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_, angle$95$m_] := Block[{t$95$0 = N[(2.0 * N[(N[(a + b), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(Pi / N[(180.0 / angle$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Cos[t$95$1], $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 2e+70], N[(t$95$2 * N[(t$95$0 * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 * N[(t$95$0 * N[Sin[N[Exp[N[Log[N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)

\\
\begin{array}{l}
t_0 := 2 \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\\
t_1 := \frac{\pi}{\frac{180}{angle_m}}\\
t_2 := \cos t_1\\
angle_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{angle_m}{180} \leq 2 \cdot 10^{+70}:\\
\;\;\;\;t_2 \cdot \left(t_0 \cdot \sin t_1\right)\\

\mathbf{else}:\\
\;\;\;\;t_2 \cdot \left(t_0 \cdot \sin \left(e^{\log \left(\pi \cdot \left(angle_m \cdot 0.005555555555555556\right)\right)}\right)\right)\\


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 angle 180) < 2.00000000000000015e70

    1. Initial program 56.1%

      \[\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. Add Preprocessing
    3. Step-by-step derivation
      1. unpow256.1%

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

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

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

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

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

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

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

      \[\leadsto \left(\left(2 \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)\right) \cdot \sin \color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)}\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]
    7. Step-by-step derivation
      1. clear-num48.4%

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

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

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

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

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

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

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

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

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

    if 2.00000000000000015e70 < (/.f64 angle 180)

    1. Initial program 32.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. Add Preprocessing
    3. Step-by-step derivation
      1. unpow232.8%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\left(2 \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)\right) \cdot \sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)\right) \cdot \cos \color{blue}{\left(\frac{\pi}{\frac{180}{angle}}\right)} \]
    9. Step-by-step derivation
      1. add-exp-log47.0%

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

        \[\leadsto \left(\left(2 \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)\right) \cdot \sin \left(e^{\log \color{blue}{\left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)}}\right)\right) \cdot \cos \left(\frac{\pi}{\frac{180}{angle}}\right) \]
    10. Applied egg-rr47.0%

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

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

Alternative 4: 57.5% accurate, 1.9× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ angle_s = \mathsf{copysign}\left(1, angle\right) \\ \begin{array}{l} t_0 := \left(a + b\right) \cdot \left(b - a\right)\\ t_1 := \pi \cdot \frac{angle_m}{180}\\ angle_s \cdot \begin{array}{l} \mathbf{if}\;a \leq 4 \cdot 10^{+204}:\\ \;\;\;\;2 \cdot \left(\cos t_1 \cdot \left(t_0 \cdot \sin t_1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(2 \cdot t_0\right) \cdot \sin \left(\frac{\pi \cdot angle_m}{180}\right)\\ \end{array} \end{array} \end{array} \]
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b angle_m)
 :precision binary64
 (let* ((t_0 (* (+ a b) (- b a))) (t_1 (* PI (/ angle_m 180.0))))
   (*
    angle_s
    (if (<= a 4e+204)
      (* 2.0 (* (cos t_1) (* t_0 (sin t_1))))
      (* (* 2.0 t_0) (sin (/ (* PI angle_m) 180.0)))))))
angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
	double t_0 = (a + b) * (b - a);
	double t_1 = ((double) M_PI) * (angle_m / 180.0);
	double tmp;
	if (a <= 4e+204) {
		tmp = 2.0 * (cos(t_1) * (t_0 * sin(t_1)));
	} else {
		tmp = (2.0 * t_0) * sin(((((double) M_PI) * angle_m) / 180.0));
	}
	return angle_s * tmp;
}
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
	double t_0 = (a + b) * (b - a);
	double t_1 = Math.PI * (angle_m / 180.0);
	double tmp;
	if (a <= 4e+204) {
		tmp = 2.0 * (Math.cos(t_1) * (t_0 * Math.sin(t_1)));
	} else {
		tmp = (2.0 * t_0) * Math.sin(((Math.PI * angle_m) / 180.0));
	}
	return angle_s * tmp;
}
angle_m = math.fabs(angle)
angle_s = math.copysign(1.0, angle)
def code(angle_s, a, b, angle_m):
	t_0 = (a + b) * (b - a)
	t_1 = math.pi * (angle_m / 180.0)
	tmp = 0
	if a <= 4e+204:
		tmp = 2.0 * (math.cos(t_1) * (t_0 * math.sin(t_1)))
	else:
		tmp = (2.0 * t_0) * math.sin(((math.pi * angle_m) / 180.0))
	return angle_s * tmp
angle_m = abs(angle)
angle_s = copysign(1.0, angle)
function code(angle_s, a, b, angle_m)
	t_0 = Float64(Float64(a + b) * Float64(b - a))
	t_1 = Float64(pi * Float64(angle_m / 180.0))
	tmp = 0.0
	if (a <= 4e+204)
		tmp = Float64(2.0 * Float64(cos(t_1) * Float64(t_0 * sin(t_1))));
	else
		tmp = Float64(Float64(2.0 * t_0) * sin(Float64(Float64(pi * angle_m) / 180.0)));
	end
	return Float64(angle_s * tmp)
end
angle_m = abs(angle);
angle_s = sign(angle) * abs(1.0);
function tmp_2 = code(angle_s, a, b, angle_m)
	t_0 = (a + b) * (b - a);
	t_1 = pi * (angle_m / 180.0);
	tmp = 0.0;
	if (a <= 4e+204)
		tmp = 2.0 * (cos(t_1) * (t_0 * sin(t_1)));
	else
		tmp = (2.0 * t_0) * sin(((pi * angle_m) / 180.0));
	end
	tmp_2 = angle_s * tmp;
end
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_, angle$95$m_] := Block[{t$95$0 = N[(N[(a + b), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[a, 4e+204], N[(2.0 * N[(N[Cos[t$95$1], $MachinePrecision] * N[(t$95$0 * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * t$95$0), $MachinePrecision] * N[Sin[N[(N[(Pi * angle$95$m), $MachinePrecision] / 180.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)

\\
\begin{array}{l}
t_0 := \left(a + b\right) \cdot \left(b - a\right)\\
t_1 := \pi \cdot \frac{angle_m}{180}\\
angle_s \cdot \begin{array}{l}
\mathbf{if}\;a \leq 4 \cdot 10^{+204}:\\
\;\;\;\;2 \cdot \left(\cos t_1 \cdot \left(t_0 \cdot \sin t_1\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\left(2 \cdot t_0\right) \cdot \sin \left(\frac{\pi \cdot angle_m}{180}\right)\\


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < 3.99999999999999996e204

    1. Initial program 53.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. Step-by-step derivation
      1. associate-*l*53.0%

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

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

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

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

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

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

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

    if 3.99999999999999996e204 < a

    1. Initial program 31.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. Add Preprocessing
    3. Step-by-step derivation
      1. unpow231.6%

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

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

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

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

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

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

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

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

Alternative 5: 57.5% accurate, 1.9× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ angle_s = \mathsf{copysign}\left(1, angle\right) \\ angle_s \cdot \left(\cos \left(\pi \cdot \frac{angle_m}{180}\right) \cdot \left(\left(2 \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\right) \cdot \sin \left(\pi \cdot \left(angle_m \cdot 0.005555555555555556\right)\right)\right)\right) \end{array} \]
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b angle_m)
 :precision binary64
 (*
  angle_s
  (*
   (cos (* PI (/ angle_m 180.0)))
   (*
    (* 2.0 (* (+ a b) (- b a)))
    (sin (* PI (* angle_m 0.005555555555555556)))))))
angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
	return angle_s * (cos((((double) M_PI) * (angle_m / 180.0))) * ((2.0 * ((a + b) * (b - a))) * sin((((double) M_PI) * (angle_m * 0.005555555555555556)))));
}
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
	return angle_s * (Math.cos((Math.PI * (angle_m / 180.0))) * ((2.0 * ((a + b) * (b - a))) * Math.sin((Math.PI * (angle_m * 0.005555555555555556)))));
}
angle_m = math.fabs(angle)
angle_s = math.copysign(1.0, angle)
def code(angle_s, a, b, angle_m):
	return angle_s * (math.cos((math.pi * (angle_m / 180.0))) * ((2.0 * ((a + b) * (b - a))) * math.sin((math.pi * (angle_m * 0.005555555555555556)))))
angle_m = abs(angle)
angle_s = copysign(1.0, angle)
function code(angle_s, a, b, angle_m)
	return Float64(angle_s * Float64(cos(Float64(pi * Float64(angle_m / 180.0))) * Float64(Float64(2.0 * Float64(Float64(a + b) * Float64(b - a))) * sin(Float64(pi * Float64(angle_m * 0.005555555555555556))))))
end
angle_m = abs(angle);
angle_s = sign(angle) * abs(1.0);
function tmp = code(angle_s, a, b, angle_m)
	tmp = angle_s * (cos((pi * (angle_m / 180.0))) * ((2.0 * ((a + b) * (b - a))) * sin((pi * (angle_m * 0.005555555555555556)))));
end
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_, angle$95$m_] := N[(angle$95$s * N[(N[Cos[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(2.0 * N[(N[(a + b), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)

\\
angle_s \cdot \left(\cos \left(\pi \cdot \frac{angle_m}{180}\right) \cdot \left(\left(2 \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\right) \cdot \sin \left(\pi \cdot \left(angle_m \cdot 0.005555555555555556\right)\right)\right)\right)
\end{array}
Derivation
  1. Initial program 51.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. Add Preprocessing
  3. Step-by-step derivation
    1. unpow251.5%

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

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

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

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

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

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

      \[\leadsto \left(\left(2 \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)\right) \cdot \sin \left(\color{blue}{\left(\pi \cdot angle\right)} \cdot 0.005555555555555556\right)\right) \cdot 1 \]
    3. associate-*r*55.6%

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

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

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

Alternative 6: 57.6% accurate, 1.9× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ angle_s = \mathsf{copysign}\left(1, angle\right) \\ angle_s \cdot \left(\left(\left(2 \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\right) \cdot \sin \left(\pi \cdot \frac{angle_m}{180}\right)\right) \cdot \cos \left(\pi \cdot \left(angle_m \cdot 0.005555555555555556\right)\right)\right) \end{array} \]
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b angle_m)
 :precision binary64
 (*
  angle_s
  (*
   (* (* 2.0 (* (+ a b) (- b a))) (sin (* PI (/ angle_m 180.0))))
   (cos (* PI (* angle_m 0.005555555555555556))))))
angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
	return angle_s * (((2.0 * ((a + b) * (b - a))) * sin((((double) M_PI) * (angle_m / 180.0)))) * cos((((double) M_PI) * (angle_m * 0.005555555555555556))));
}
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
	return angle_s * (((2.0 * ((a + b) * (b - a))) * Math.sin((Math.PI * (angle_m / 180.0)))) * Math.cos((Math.PI * (angle_m * 0.005555555555555556))));
}
angle_m = math.fabs(angle)
angle_s = math.copysign(1.0, angle)
def code(angle_s, a, b, angle_m):
	return angle_s * (((2.0 * ((a + b) * (b - a))) * math.sin((math.pi * (angle_m / 180.0)))) * math.cos((math.pi * (angle_m * 0.005555555555555556))))
angle_m = abs(angle)
angle_s = copysign(1.0, angle)
function code(angle_s, a, b, angle_m)
	return Float64(angle_s * Float64(Float64(Float64(2.0 * Float64(Float64(a + b) * Float64(b - a))) * sin(Float64(pi * Float64(angle_m / 180.0)))) * cos(Float64(pi * Float64(angle_m * 0.005555555555555556)))))
end
angle_m = abs(angle);
angle_s = sign(angle) * abs(1.0);
function tmp = code(angle_s, a, b, angle_m)
	tmp = angle_s * (((2.0 * ((a + b) * (b - a))) * sin((pi * (angle_m / 180.0)))) * cos((pi * (angle_m * 0.005555555555555556))));
end
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_, angle$95$m_] := N[(angle$95$s * N[(N[(N[(2.0 * N[(N[(a + b), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)

\\
angle_s \cdot \left(\left(\left(2 \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\right) \cdot \sin \left(\pi \cdot \frac{angle_m}{180}\right)\right) \cdot \cos \left(\pi \cdot \left(angle_m \cdot 0.005555555555555556\right)\right)\right)
\end{array}
Derivation
  1. Initial program 51.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. Add Preprocessing
  3. Step-by-step derivation
    1. unpow251.5%

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

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

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

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

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

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

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

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

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

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

Alternative 7: 57.5% accurate, 1.9× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ angle_s = \mathsf{copysign}\left(1, angle\right) \\ angle_s \cdot \left(\left(\left(2 \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\right) \cdot \sin \left(\pi \cdot \frac{angle_m}{180}\right)\right) \cdot \cos \left(\frac{\pi \cdot angle_m}{180}\right)\right) \end{array} \]
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b angle_m)
 :precision binary64
 (*
  angle_s
  (*
   (* (* 2.0 (* (+ a b) (- b a))) (sin (* PI (/ angle_m 180.0))))
   (cos (/ (* PI angle_m) 180.0)))))
angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
	return angle_s * (((2.0 * ((a + b) * (b - a))) * sin((((double) M_PI) * (angle_m / 180.0)))) * cos(((((double) M_PI) * angle_m) / 180.0)));
}
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
	return angle_s * (((2.0 * ((a + b) * (b - a))) * Math.sin((Math.PI * (angle_m / 180.0)))) * Math.cos(((Math.PI * angle_m) / 180.0)));
}
angle_m = math.fabs(angle)
angle_s = math.copysign(1.0, angle)
def code(angle_s, a, b, angle_m):
	return angle_s * (((2.0 * ((a + b) * (b - a))) * math.sin((math.pi * (angle_m / 180.0)))) * math.cos(((math.pi * angle_m) / 180.0)))
angle_m = abs(angle)
angle_s = copysign(1.0, angle)
function code(angle_s, a, b, angle_m)
	return Float64(angle_s * Float64(Float64(Float64(2.0 * Float64(Float64(a + b) * Float64(b - a))) * sin(Float64(pi * Float64(angle_m / 180.0)))) * cos(Float64(Float64(pi * angle_m) / 180.0))))
end
angle_m = abs(angle);
angle_s = sign(angle) * abs(1.0);
function tmp = code(angle_s, a, b, angle_m)
	tmp = angle_s * (((2.0 * ((a + b) * (b - a))) * sin((pi * (angle_m / 180.0)))) * cos(((pi * angle_m) / 180.0)));
end
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_, angle$95$m_] := N[(angle$95$s * N[(N[(N[(2.0 * N[(N[(a + b), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(N[(Pi * angle$95$m), $MachinePrecision] / 180.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)

\\
angle_s \cdot \left(\left(\left(2 \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\right) \cdot \sin \left(\pi \cdot \frac{angle_m}{180}\right)\right) \cdot \cos \left(\frac{\pi \cdot angle_m}{180}\right)\right)
\end{array}
Derivation
  1. Initial program 51.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. Add Preprocessing
  3. Step-by-step derivation
    1. unpow251.5%

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

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

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

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

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

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

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

Alternative 8: 57.3% accurate, 1.9× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ angle_s = \mathsf{copysign}\left(1, angle\right) \\ angle_s \cdot \left(\cos \left(\pi \cdot \frac{angle_m}{180}\right) \cdot \left(\left(2 \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\right) \cdot \sin \left(\frac{\pi}{\frac{180}{angle_m}}\right)\right)\right) \end{array} \]
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b angle_m)
 :precision binary64
 (*
  angle_s
  (*
   (cos (* PI (/ angle_m 180.0)))
   (* (* 2.0 (* (+ a b) (- b a))) (sin (/ PI (/ 180.0 angle_m)))))))
angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
	return angle_s * (cos((((double) M_PI) * (angle_m / 180.0))) * ((2.0 * ((a + b) * (b - a))) * sin((((double) M_PI) / (180.0 / angle_m)))));
}
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
	return angle_s * (Math.cos((Math.PI * (angle_m / 180.0))) * ((2.0 * ((a + b) * (b - a))) * Math.sin((Math.PI / (180.0 / angle_m)))));
}
angle_m = math.fabs(angle)
angle_s = math.copysign(1.0, angle)
def code(angle_s, a, b, angle_m):
	return angle_s * (math.cos((math.pi * (angle_m / 180.0))) * ((2.0 * ((a + b) * (b - a))) * math.sin((math.pi / (180.0 / angle_m)))))
angle_m = abs(angle)
angle_s = copysign(1.0, angle)
function code(angle_s, a, b, angle_m)
	return Float64(angle_s * Float64(cos(Float64(pi * Float64(angle_m / 180.0))) * Float64(Float64(2.0 * Float64(Float64(a + b) * Float64(b - a))) * sin(Float64(pi / Float64(180.0 / angle_m))))))
end
angle_m = abs(angle);
angle_s = sign(angle) * abs(1.0);
function tmp = code(angle_s, a, b, angle_m)
	tmp = angle_s * (cos((pi * (angle_m / 180.0))) * ((2.0 * ((a + b) * (b - a))) * sin((pi / (180.0 / angle_m)))));
end
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_, angle$95$m_] := N[(angle$95$s * N[(N[Cos[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(2.0 * N[(N[(a + b), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(Pi / N[(180.0 / angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)

\\
angle_s \cdot \left(\cos \left(\pi \cdot \frac{angle_m}{180}\right) \cdot \left(\left(2 \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\right) \cdot \sin \left(\frac{\pi}{\frac{180}{angle_m}}\right)\right)\right)
\end{array}
Derivation
  1. Initial program 51.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. Add Preprocessing
  3. Step-by-step derivation
    1. unpow251.5%

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

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

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

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

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

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

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

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

Alternative 9: 57.6% accurate, 1.9× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ angle_s = \mathsf{copysign}\left(1, angle\right) \\ \begin{array}{l} t_0 := \frac{\pi}{\frac{180}{angle_m}}\\ angle_s \cdot \left(\cos t_0 \cdot \left(\left(2 \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\right) \cdot \sin t_0\right)\right) \end{array} \end{array} \]
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b angle_m)
 :precision binary64
 (let* ((t_0 (/ PI (/ 180.0 angle_m))))
   (* angle_s (* (cos t_0) (* (* 2.0 (* (+ a b) (- b a))) (sin t_0))))))
angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
	double t_0 = ((double) M_PI) / (180.0 / angle_m);
	return angle_s * (cos(t_0) * ((2.0 * ((a + b) * (b - a))) * sin(t_0)));
}
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
	double t_0 = Math.PI / (180.0 / angle_m);
	return angle_s * (Math.cos(t_0) * ((2.0 * ((a + b) * (b - a))) * Math.sin(t_0)));
}
angle_m = math.fabs(angle)
angle_s = math.copysign(1.0, angle)
def code(angle_s, a, b, angle_m):
	t_0 = math.pi / (180.0 / angle_m)
	return angle_s * (math.cos(t_0) * ((2.0 * ((a + b) * (b - a))) * math.sin(t_0)))
angle_m = abs(angle)
angle_s = copysign(1.0, angle)
function code(angle_s, a, b, angle_m)
	t_0 = Float64(pi / Float64(180.0 / angle_m))
	return Float64(angle_s * Float64(cos(t_0) * Float64(Float64(2.0 * Float64(Float64(a + b) * Float64(b - a))) * sin(t_0))))
end
angle_m = abs(angle);
angle_s = sign(angle) * abs(1.0);
function tmp = code(angle_s, a, b, angle_m)
	t_0 = pi / (180.0 / angle_m);
	tmp = angle_s * (cos(t_0) * ((2.0 * ((a + b) * (b - a))) * sin(t_0)));
end
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_, angle$95$m_] := Block[{t$95$0 = N[(Pi / N[(180.0 / angle$95$m), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * N[(N[Cos[t$95$0], $MachinePrecision] * N[(N[(2.0 * N[(N[(a + b), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)

\\
\begin{array}{l}
t_0 := \frac{\pi}{\frac{180}{angle_m}}\\
angle_s \cdot \left(\cos t_0 \cdot \left(\left(2 \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\right) \cdot \sin t_0\right)\right)
\end{array}
\end{array}
Derivation
  1. Initial program 51.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. Add Preprocessing
  3. Step-by-step derivation
    1. unpow251.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 56.4% accurate, 3.6× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ angle_s = \mathsf{copysign}\left(1, angle\right) \\ angle_s \cdot \left(\left(2 \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\right) \cdot \sin \left(angle_m \cdot \frac{\pi}{180}\right)\right) \end{array} \]
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b angle_m)
 :precision binary64
 (* angle_s (* (* 2.0 (* (+ a b) (- b a))) (sin (* angle_m (/ PI 180.0))))))
angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
	return angle_s * ((2.0 * ((a + b) * (b - a))) * sin((angle_m * (((double) M_PI) / 180.0))));
}
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
	return angle_s * ((2.0 * ((a + b) * (b - a))) * Math.sin((angle_m * (Math.PI / 180.0))));
}
angle_m = math.fabs(angle)
angle_s = math.copysign(1.0, angle)
def code(angle_s, a, b, angle_m):
	return angle_s * ((2.0 * ((a + b) * (b - a))) * math.sin((angle_m * (math.pi / 180.0))))
angle_m = abs(angle)
angle_s = copysign(1.0, angle)
function code(angle_s, a, b, angle_m)
	return Float64(angle_s * Float64(Float64(2.0 * Float64(Float64(a + b) * Float64(b - a))) * sin(Float64(angle_m * Float64(pi / 180.0)))))
end
angle_m = abs(angle);
angle_s = sign(angle) * abs(1.0);
function tmp = code(angle_s, a, b, angle_m)
	tmp = angle_s * ((2.0 * ((a + b) * (b - a))) * sin((angle_m * (pi / 180.0))));
end
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_, angle$95$m_] := N[(angle$95$s * N[(N[(2.0 * N[(N[(a + b), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(angle$95$m * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)

\\
angle_s \cdot \left(\left(2 \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\right) \cdot \sin \left(angle_m \cdot \frac{\pi}{180}\right)\right)
\end{array}
Derivation
  1. Initial program 51.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. Add Preprocessing
  3. Step-by-step derivation
    1. unpow251.5%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 56.5% accurate, 3.6× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ angle_s = \mathsf{copysign}\left(1, angle\right) \\ angle_s \cdot \left(\left(2 \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\right) \cdot \sin \left(\pi \cdot \left(angle_m \cdot 0.005555555555555556\right)\right)\right) \end{array} \]
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b angle_m)
 :precision binary64
 (*
  angle_s
  (*
   (* 2.0 (* (+ a b) (- b a)))
   (sin (* PI (* angle_m 0.005555555555555556))))))
angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
	return angle_s * ((2.0 * ((a + b) * (b - a))) * sin((((double) M_PI) * (angle_m * 0.005555555555555556))));
}
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
	return angle_s * ((2.0 * ((a + b) * (b - a))) * Math.sin((Math.PI * (angle_m * 0.005555555555555556))));
}
angle_m = math.fabs(angle)
angle_s = math.copysign(1.0, angle)
def code(angle_s, a, b, angle_m):
	return angle_s * ((2.0 * ((a + b) * (b - a))) * math.sin((math.pi * (angle_m * 0.005555555555555556))))
angle_m = abs(angle)
angle_s = copysign(1.0, angle)
function code(angle_s, a, b, angle_m)
	return Float64(angle_s * Float64(Float64(2.0 * Float64(Float64(a + b) * Float64(b - a))) * sin(Float64(pi * Float64(angle_m * 0.005555555555555556)))))
end
angle_m = abs(angle);
angle_s = sign(angle) * abs(1.0);
function tmp = code(angle_s, a, b, angle_m)
	tmp = angle_s * ((2.0 * ((a + b) * (b - a))) * sin((pi * (angle_m * 0.005555555555555556))));
end
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_, angle$95$m_] := N[(angle$95$s * N[(N[(2.0 * N[(N[(a + b), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)

\\
angle_s \cdot \left(\left(2 \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\right) \cdot \sin \left(\pi \cdot \left(angle_m \cdot 0.005555555555555556\right)\right)\right)
\end{array}
Derivation
  1. Initial program 51.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. Add Preprocessing
  3. Step-by-step derivation
    1. unpow251.5%

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

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

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

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

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

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

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

      \[\leadsto \left(\left(2 \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)\right) \cdot \sin \left(\color{blue}{\left(\pi \cdot angle\right)} \cdot 0.005555555555555556\right)\right) \cdot 1 \]
    3. associate-*r*55.6%

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

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

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

Alternative 12: 56.3% accurate, 3.6× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ angle_s = \mathsf{copysign}\left(1, angle\right) \\ angle_s \cdot \left(\left(2 \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\right) \cdot \sin \left(\frac{\pi \cdot angle_m}{180}\right)\right) \end{array} \]
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b angle_m)
 :precision binary64
 (* angle_s (* (* 2.0 (* (+ a b) (- b a))) (sin (/ (* PI angle_m) 180.0)))))
angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
	return angle_s * ((2.0 * ((a + b) * (b - a))) * sin(((((double) M_PI) * angle_m) / 180.0)));
}
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
	return angle_s * ((2.0 * ((a + b) * (b - a))) * Math.sin(((Math.PI * angle_m) / 180.0)));
}
angle_m = math.fabs(angle)
angle_s = math.copysign(1.0, angle)
def code(angle_s, a, b, angle_m):
	return angle_s * ((2.0 * ((a + b) * (b - a))) * math.sin(((math.pi * angle_m) / 180.0)))
angle_m = abs(angle)
angle_s = copysign(1.0, angle)
function code(angle_s, a, b, angle_m)
	return Float64(angle_s * Float64(Float64(2.0 * Float64(Float64(a + b) * Float64(b - a))) * sin(Float64(Float64(pi * angle_m) / 180.0))))
end
angle_m = abs(angle);
angle_s = sign(angle) * abs(1.0);
function tmp = code(angle_s, a, b, angle_m)
	tmp = angle_s * ((2.0 * ((a + b) * (b - a))) * sin(((pi * angle_m) / 180.0)));
end
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_, angle$95$m_] := N[(angle$95$s * N[(N[(2.0 * N[(N[(a + b), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(N[(Pi * angle$95$m), $MachinePrecision] / 180.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)

\\
angle_s \cdot \left(\left(2 \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\right) \cdot \sin \left(\frac{\pi \cdot angle_m}{180}\right)\right)
\end{array}
Derivation
  1. Initial program 51.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. Add Preprocessing
  3. Step-by-step derivation
    1. unpow251.5%

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

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

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

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

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

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

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

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

Alternative 13: 54.4% accurate, 32.2× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ angle_s = \mathsf{copysign}\left(1, angle\right) \\ angle_s \cdot \left(0.011111111111111112 \cdot \left(angle_m \cdot \left(\left(\left(a + b\right) \cdot \left(b - a\right)\right) \cdot \pi\right)\right)\right) \end{array} \]
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b angle_m)
 :precision binary64
 (* angle_s (* 0.011111111111111112 (* angle_m (* (* (+ a b) (- b a)) PI)))))
angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
	return angle_s * (0.011111111111111112 * (angle_m * (((a + b) * (b - a)) * ((double) M_PI))));
}
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
	return angle_s * (0.011111111111111112 * (angle_m * (((a + b) * (b - a)) * Math.PI)));
}
angle_m = math.fabs(angle)
angle_s = math.copysign(1.0, angle)
def code(angle_s, a, b, angle_m):
	return angle_s * (0.011111111111111112 * (angle_m * (((a + b) * (b - a)) * math.pi)))
angle_m = abs(angle)
angle_s = copysign(1.0, angle)
function code(angle_s, a, b, angle_m)
	return Float64(angle_s * Float64(0.011111111111111112 * Float64(angle_m * Float64(Float64(Float64(a + b) * Float64(b - a)) * pi))))
end
angle_m = abs(angle);
angle_s = sign(angle) * abs(1.0);
function tmp = code(angle_s, a, b, angle_m)
	tmp = angle_s * (0.011111111111111112 * (angle_m * (((a + b) * (b - a)) * pi)));
end
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_, angle$95$m_] := N[(angle$95$s * N[(0.011111111111111112 * N[(angle$95$m * N[(N[(N[(a + b), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)

\\
angle_s \cdot \left(0.011111111111111112 \cdot \left(angle_m \cdot \left(\left(\left(a + b\right) \cdot \left(b - a\right)\right) \cdot \pi\right)\right)\right)
\end{array}
Derivation
  1. Initial program 51.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. Add Preprocessing
  3. Step-by-step derivation
    1. unpow251.5%

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

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

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

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

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

    \[\leadsto \color{blue}{\left(0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\right)\right)\right)} \cdot 1 \]
  7. Final simplification51.1%

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

Reproduce

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