ab-angle->ABCF B

Percentage Accurate: 52.8% → 66.9%
Time: 16.8s
Alternatives: 13
Speedup: 10.3×

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: 52.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: 66.9% accurate, 3.4× speedup?

\[\begin{array}{l} a_m = \left|a\right| \\ \begin{array}{l} \mathbf{if}\;a\_m \leq 4 \cdot 10^{+191}:\\ \;\;\;\;\left(a\_m + b\right) \cdot \left(\left(b - a\_m\right) \cdot \sin \left(\left(0.011111111111111112 \cdot \pi\right) \cdot angle\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(a\_m + b\right) \cdot \left(\pi \cdot \left(0.011111111111111112 \cdot angle\right)\right)}{\frac{1}{b - a\_m}}\\ \end{array} \end{array} \]
a_m = (fabs.f64 a)
(FPCore (a_m b angle)
 :precision binary64
 (if (<= a_m 4e+191)
   (* (+ a_m b) (* (- b a_m) (sin (* (* 0.011111111111111112 PI) angle))))
   (/ (* (+ a_m b) (* PI (* 0.011111111111111112 angle))) (/ 1.0 (- b a_m)))))
a_m = fabs(a);
double code(double a_m, double b, double angle) {
	double tmp;
	if (a_m <= 4e+191) {
		tmp = (a_m + b) * ((b - a_m) * sin(((0.011111111111111112 * ((double) M_PI)) * angle)));
	} else {
		tmp = ((a_m + b) * (((double) M_PI) * (0.011111111111111112 * angle))) / (1.0 / (b - a_m));
	}
	return tmp;
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle) {
	double tmp;
	if (a_m <= 4e+191) {
		tmp = (a_m + b) * ((b - a_m) * Math.sin(((0.011111111111111112 * Math.PI) * angle)));
	} else {
		tmp = ((a_m + b) * (Math.PI * (0.011111111111111112 * angle))) / (1.0 / (b - a_m));
	}
	return tmp;
}
a_m = math.fabs(a)
def code(a_m, b, angle):
	tmp = 0
	if a_m <= 4e+191:
		tmp = (a_m + b) * ((b - a_m) * math.sin(((0.011111111111111112 * math.pi) * angle)))
	else:
		tmp = ((a_m + b) * (math.pi * (0.011111111111111112 * angle))) / (1.0 / (b - a_m))
	return tmp
a_m = abs(a)
function code(a_m, b, angle)
	tmp = 0.0
	if (a_m <= 4e+191)
		tmp = Float64(Float64(a_m + b) * Float64(Float64(b - a_m) * sin(Float64(Float64(0.011111111111111112 * pi) * angle))));
	else
		tmp = Float64(Float64(Float64(a_m + b) * Float64(pi * Float64(0.011111111111111112 * angle))) / Float64(1.0 / Float64(b - a_m)));
	end
	return tmp
end
a_m = abs(a);
function tmp_2 = code(a_m, b, angle)
	tmp = 0.0;
	if (a_m <= 4e+191)
		tmp = (a_m + b) * ((b - a_m) * sin(((0.011111111111111112 * pi) * angle)));
	else
		tmp = ((a_m + b) * (pi * (0.011111111111111112 * angle))) / (1.0 / (b - a_m));
	end
	tmp_2 = tmp;
end
a_m = N[Abs[a], $MachinePrecision]
code[a$95$m_, b_, angle_] := If[LessEqual[a$95$m, 4e+191], N[(N[(a$95$m + b), $MachinePrecision] * N[(N[(b - a$95$m), $MachinePrecision] * N[Sin[N[(N[(0.011111111111111112 * Pi), $MachinePrecision] * angle), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a$95$m + b), $MachinePrecision] * N[(Pi * N[(0.011111111111111112 * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 / N[(b - a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|

\\
\begin{array}{l}
\mathbf{if}\;a\_m \leq 4 \cdot 10^{+191}:\\
\;\;\;\;\left(a\_m + b\right) \cdot \left(\left(b - a\_m\right) \cdot \sin \left(\left(0.011111111111111112 \cdot \pi\right) \cdot angle\right)\right)\\

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


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

    1. Initial program 52.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. Applied rewrites62.9%

      \[\leadsto \color{blue}{\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right)\right)} \]
    4. Step-by-step derivation
      1. lift-PI.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\left(\color{blue}{\mathsf{PI}\left(\right)} \cdot angle\right) \cdot \frac{1}{90}\right)\right) \]
      2. lift-*.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot angle\right)} \cdot \frac{1}{90}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \color{blue}{\left(\frac{1}{90} \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)}\right) \]
      4. lift-*.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\frac{1}{90} \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot angle\right)}\right)\right) \]
      5. associate-*r*N/A

        \[\leadsto \left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \color{blue}{\left(\left(\frac{1}{90} \cdot \mathsf{PI}\left(\right)\right) \cdot angle\right)}\right) \]
      6. lower-*.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \color{blue}{\left(\left(\frac{1}{90} \cdot \mathsf{PI}\left(\right)\right) \cdot angle\right)}\right) \]
      7. lower-*.f6464.5

        \[\leadsto \left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\color{blue}{\left(0.011111111111111112 \cdot \pi\right)} \cdot angle\right)\right) \]
    5. Applied rewrites64.5%

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

    if 4.00000000000000029e191 < a

    1. Initial program 50.2%

      \[\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in angle around 0

      \[\leadsto \color{blue}{\frac{1}{90} \cdot \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \frac{1}{90} \cdot \color{blue}{\left(\left(angle \cdot \mathsf{PI}\left(\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)} \]
      2. associate-*r*N/A

        \[\leadsto \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot \left({b}^{2} - {a}^{2}\right) \]
      5. lower-*.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot \left({b}^{2} - {a}^{2}\right) \]
      6. lower-PI.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \cdot \left({b}^{2} - {a}^{2}\right) \]
      7. unpow2N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\color{blue}{b \cdot b} - {a}^{2}\right) \]
      8. unpow2N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(b \cdot b - \color{blue}{a \cdot a}\right) \]
      9. difference-of-squaresN/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \]
      10. lower-*.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \]
      11. lower-+.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\color{blue}{\left(b + a\right)} \cdot \left(b - a\right)\right) \]
      12. lower--.f6483.5

        \[\leadsto \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(\left(b + a\right) \cdot \color{blue}{\left(b - a\right)}\right) \]
    5. Applied rewrites83.5%

      \[\leadsto \color{blue}{\left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)} \]
    6. Step-by-step derivation
      1. lift-PI.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right) \]
      2. lift-*.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right) \]
      3. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right) \]
      4. lift-+.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\color{blue}{\left(b + a\right)} \cdot \left(b - a\right)\right) \]
      5. lift--.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\left(b + a\right) \cdot \color{blue}{\left(b - a\right)}\right) \]
      6. associate-*r*N/A

        \[\leadsto \color{blue}{\left(\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(b + a\right)\right) \cdot \left(b - a\right)} \]
      7. lift--.f64N/A

        \[\leadsto \left(\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(b + a\right)\right) \cdot \color{blue}{\left(b - a\right)} \]
      8. flip3--N/A

        \[\leadsto \left(\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(b + a\right)\right) \cdot \color{blue}{\frac{{b}^{3} - {a}^{3}}{b \cdot b + \left(a \cdot a + b \cdot a\right)}} \]
      9. clear-numN/A

        \[\leadsto \left(\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(b + a\right)\right) \cdot \color{blue}{\frac{1}{\frac{b \cdot b + \left(a \cdot a + b \cdot a\right)}{{b}^{3} - {a}^{3}}}} \]
      10. clear-numN/A

        \[\leadsto \left(\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(b + a\right)\right) \cdot \frac{1}{\color{blue}{\frac{1}{\frac{{b}^{3} - {a}^{3}}{b \cdot b + \left(a \cdot a + b \cdot a\right)}}}} \]
      11. flip3--N/A

        \[\leadsto \left(\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(b + a\right)\right) \cdot \frac{1}{\frac{1}{\color{blue}{b - a}}} \]
      12. lift--.f64N/A

        \[\leadsto \left(\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(b + a\right)\right) \cdot \frac{1}{\frac{1}{\color{blue}{b - a}}} \]
      13. un-div-invN/A

        \[\leadsto \color{blue}{\frac{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(b + a\right)}{\frac{1}{b - a}}} \]
      14. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(b + a\right)}{\frac{1}{b - a}}} \]
    7. Applied rewrites87.5%

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

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

Alternative 2: 65.7% accurate, 0.8× speedup?

\[\begin{array}{l} a_m = \left|a\right| \\ \begin{array}{l} t_0 := {b}^{2} - {a\_m}^{2}\\ t_1 := \pi \cdot \left(0.011111111111111112 \cdot angle\right)\\ \mathbf{if}\;t\_0 \leq -\infty:\\ \;\;\;\;\left(a\_m + b\right) \cdot \left(\left(0.011111111111111112 \cdot angle\right) \cdot \left(\left(b - a\_m\right) \cdot \pi\right)\right)\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+284}:\\ \;\;\;\;\left(\left(a\_m + b\right) \cdot \left(b - a\_m\right)\right) \cdot \sin t\_1\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(a\_m + b\right) \cdot t\_1}{\frac{1}{b - a\_m}}\\ \end{array} \end{array} \]
a_m = (fabs.f64 a)
(FPCore (a_m b angle)
 :precision binary64
 (let* ((t_0 (- (pow b 2.0) (pow a_m 2.0)))
        (t_1 (* PI (* 0.011111111111111112 angle))))
   (if (<= t_0 (- INFINITY))
     (* (+ a_m b) (* (* 0.011111111111111112 angle) (* (- b a_m) PI)))
     (if (<= t_0 5e+284)
       (* (* (+ a_m b) (- b a_m)) (sin t_1))
       (/ (* (+ a_m b) t_1) (/ 1.0 (- b a_m)))))))
a_m = fabs(a);
double code(double a_m, double b, double angle) {
	double t_0 = pow(b, 2.0) - pow(a_m, 2.0);
	double t_1 = ((double) M_PI) * (0.011111111111111112 * angle);
	double tmp;
	if (t_0 <= -((double) INFINITY)) {
		tmp = (a_m + b) * ((0.011111111111111112 * angle) * ((b - a_m) * ((double) M_PI)));
	} else if (t_0 <= 5e+284) {
		tmp = ((a_m + b) * (b - a_m)) * sin(t_1);
	} else {
		tmp = ((a_m + b) * t_1) / (1.0 / (b - a_m));
	}
	return tmp;
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle) {
	double t_0 = Math.pow(b, 2.0) - Math.pow(a_m, 2.0);
	double t_1 = Math.PI * (0.011111111111111112 * angle);
	double tmp;
	if (t_0 <= -Double.POSITIVE_INFINITY) {
		tmp = (a_m + b) * ((0.011111111111111112 * angle) * ((b - a_m) * Math.PI));
	} else if (t_0 <= 5e+284) {
		tmp = ((a_m + b) * (b - a_m)) * Math.sin(t_1);
	} else {
		tmp = ((a_m + b) * t_1) / (1.0 / (b - a_m));
	}
	return tmp;
}
a_m = math.fabs(a)
def code(a_m, b, angle):
	t_0 = math.pow(b, 2.0) - math.pow(a_m, 2.0)
	t_1 = math.pi * (0.011111111111111112 * angle)
	tmp = 0
	if t_0 <= -math.inf:
		tmp = (a_m + b) * ((0.011111111111111112 * angle) * ((b - a_m) * math.pi))
	elif t_0 <= 5e+284:
		tmp = ((a_m + b) * (b - a_m)) * math.sin(t_1)
	else:
		tmp = ((a_m + b) * t_1) / (1.0 / (b - a_m))
	return tmp
a_m = abs(a)
function code(a_m, b, angle)
	t_0 = Float64((b ^ 2.0) - (a_m ^ 2.0))
	t_1 = Float64(pi * Float64(0.011111111111111112 * angle))
	tmp = 0.0
	if (t_0 <= Float64(-Inf))
		tmp = Float64(Float64(a_m + b) * Float64(Float64(0.011111111111111112 * angle) * Float64(Float64(b - a_m) * pi)));
	elseif (t_0 <= 5e+284)
		tmp = Float64(Float64(Float64(a_m + b) * Float64(b - a_m)) * sin(t_1));
	else
		tmp = Float64(Float64(Float64(a_m + b) * t_1) / Float64(1.0 / Float64(b - a_m)));
	end
	return tmp
end
a_m = abs(a);
function tmp_2 = code(a_m, b, angle)
	t_0 = (b ^ 2.0) - (a_m ^ 2.0);
	t_1 = pi * (0.011111111111111112 * angle);
	tmp = 0.0;
	if (t_0 <= -Inf)
		tmp = (a_m + b) * ((0.011111111111111112 * angle) * ((b - a_m) * pi));
	elseif (t_0 <= 5e+284)
		tmp = ((a_m + b) * (b - a_m)) * sin(t_1);
	else
		tmp = ((a_m + b) * t_1) / (1.0 / (b - a_m));
	end
	tmp_2 = tmp;
end
a_m = N[Abs[a], $MachinePrecision]
code[a$95$m_, b_, angle_] := Block[{t$95$0 = N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(Pi * N[(0.011111111111111112 * angle), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(a$95$m + b), $MachinePrecision] * N[(N[(0.011111111111111112 * angle), $MachinePrecision] * N[(N[(b - a$95$m), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+284], N[(N[(N[(a$95$m + b), $MachinePrecision] * N[(b - a$95$m), $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision], N[(N[(N[(a$95$m + b), $MachinePrecision] * t$95$1), $MachinePrecision] / N[(1.0 / N[(b - a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
a_m = \left|a\right|

\\
\begin{array}{l}
t_0 := {b}^{2} - {a\_m}^{2}\\
t_1 := \pi \cdot \left(0.011111111111111112 \cdot angle\right)\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\left(a\_m + b\right) \cdot \left(\left(0.011111111111111112 \cdot angle\right) \cdot \left(\left(b - a\_m\right) \cdot \pi\right)\right)\\

\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+284}:\\
\;\;\;\;\left(\left(a\_m + b\right) \cdot \left(b - a\_m\right)\right) \cdot \sin t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64))) < -inf.0

    1. Initial program 49.9%

      \[\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. Applied rewrites72.2%

      \[\leadsto \color{blue}{\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right)\right)} \]
    4. Taylor expanded in angle around 0

      \[\leadsto \left(b + a\right) \cdot \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot \left(b - a\right)\right)\right)\right)} \]
    5. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(b + a\right) \cdot \color{blue}{\left(\left(\frac{1}{90} \cdot angle\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(b - a\right)\right)\right)} \]
      2. lower-*.f64N/A

        \[\leadsto \left(b + a\right) \cdot \color{blue}{\left(\left(\frac{1}{90} \cdot angle\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(b - a\right)\right)\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\color{blue}{\left(\frac{1}{90} \cdot angle\right)} \cdot \left(\mathsf{PI}\left(\right) \cdot \left(b - a\right)\right)\right) \]
      4. lower-*.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\left(\frac{1}{90} \cdot angle\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \left(b - a\right)\right)}\right) \]
      5. lower-PI.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\left(\frac{1}{90} \cdot angle\right) \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \left(b - a\right)\right)\right) \]
      6. lower--.f6482.9

        \[\leadsto \left(b + a\right) \cdot \left(\left(0.011111111111111112 \cdot angle\right) \cdot \left(\pi \cdot \color{blue}{\left(b - a\right)}\right)\right) \]
    6. Applied rewrites82.9%

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

    if -inf.0 < (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64))) < 4.9999999999999999e284

    1. Initial program 58.4%

      \[\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]
    2. Add Preprocessing
    3. Applied rewrites58.0%

      \[\leadsto \color{blue}{\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right)\right)} \]
    4. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \color{blue}{\left(b + a\right)} \cdot \left(\left(b - a\right) \cdot \sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right)\right) \]
      2. lift--.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\color{blue}{\left(b - a\right)} \cdot \sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right)\right) \]
      3. lift-PI.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\left(\color{blue}{\mathsf{PI}\left(\right)} \cdot angle\right) \cdot \frac{1}{90}\right)\right) \]
      4. lift-*.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot angle\right)} \cdot \frac{1}{90}\right)\right) \]
      5. lift-*.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \color{blue}{\left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right)}\right) \]
      6. lift-sin.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\left(b - a\right) \cdot \color{blue}{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right)}\right) \]
      7. associate-*r*N/A

        \[\leadsto \color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right)} \]
      8. lift-+.f64N/A

        \[\leadsto \left(\color{blue}{\left(b + a\right)} \cdot \left(b - a\right)\right) \cdot \sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right) \]
      9. lift--.f64N/A

        \[\leadsto \left(\left(b + a\right) \cdot \color{blue}{\left(b - a\right)}\right) \cdot \sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right) \]
      10. difference-of-squaresN/A

        \[\leadsto \color{blue}{\left(b \cdot b - a \cdot a\right)} \cdot \sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right) \]
      11. pow2N/A

        \[\leadsto \left(\color{blue}{{b}^{2}} - a \cdot a\right) \cdot \sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right) \]
      12. lift-pow.f64N/A

        \[\leadsto \left(\color{blue}{{b}^{2}} - a \cdot a\right) \cdot \sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right) \]
      13. pow2N/A

        \[\leadsto \left({b}^{2} - \color{blue}{{a}^{2}}\right) \cdot \sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right) \]
      14. lift-pow.f64N/A

        \[\leadsto \left({b}^{2} - \color{blue}{{a}^{2}}\right) \cdot \sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right) \]
      15. lift--.f64N/A

        \[\leadsto \color{blue}{\left({b}^{2} - {a}^{2}\right)} \cdot \sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{90}\right) \]
      16. lower-*.f6458.0

        \[\leadsto \color{blue}{\left({b}^{2} - {a}^{2}\right) \cdot \sin \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right)} \]
    5. Applied rewrites58.2%

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

    if 4.9999999999999999e284 < (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))

    1. Initial program 39.2%

      \[\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in angle around 0

      \[\leadsto \color{blue}{\frac{1}{90} \cdot \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \frac{1}{90} \cdot \color{blue}{\left(\left(angle \cdot \mathsf{PI}\left(\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)} \]
      2. associate-*r*N/A

        \[\leadsto \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot \left({b}^{2} - {a}^{2}\right) \]
      5. lower-*.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot \left({b}^{2} - {a}^{2}\right) \]
      6. lower-PI.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \cdot \left({b}^{2} - {a}^{2}\right) \]
      7. unpow2N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\color{blue}{b \cdot b} - {a}^{2}\right) \]
      8. unpow2N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(b \cdot b - \color{blue}{a \cdot a}\right) \]
      9. difference-of-squaresN/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \]
      10. lower-*.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \]
      11. lower-+.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\color{blue}{\left(b + a\right)} \cdot \left(b - a\right)\right) \]
      12. lower--.f6457.6

        \[\leadsto \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(\left(b + a\right) \cdot \color{blue}{\left(b - a\right)}\right) \]
    5. Applied rewrites57.6%

      \[\leadsto \color{blue}{\left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)} \]
    6. Step-by-step derivation
      1. lift-PI.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right) \]
      2. lift-*.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right) \]
      3. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right) \]
      4. lift-+.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\color{blue}{\left(b + a\right)} \cdot \left(b - a\right)\right) \]
      5. lift--.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\left(b + a\right) \cdot \color{blue}{\left(b - a\right)}\right) \]
      6. associate-*r*N/A

        \[\leadsto \color{blue}{\left(\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(b + a\right)\right) \cdot \left(b - a\right)} \]
      7. lift--.f64N/A

        \[\leadsto \left(\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(b + a\right)\right) \cdot \color{blue}{\left(b - a\right)} \]
      8. flip3--N/A

        \[\leadsto \left(\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(b + a\right)\right) \cdot \color{blue}{\frac{{b}^{3} - {a}^{3}}{b \cdot b + \left(a \cdot a + b \cdot a\right)}} \]
      9. clear-numN/A

        \[\leadsto \left(\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(b + a\right)\right) \cdot \color{blue}{\frac{1}{\frac{b \cdot b + \left(a \cdot a + b \cdot a\right)}{{b}^{3} - {a}^{3}}}} \]
      10. clear-numN/A

        \[\leadsto \left(\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(b + a\right)\right) \cdot \frac{1}{\color{blue}{\frac{1}{\frac{{b}^{3} - {a}^{3}}{b \cdot b + \left(a \cdot a + b \cdot a\right)}}}} \]
      11. flip3--N/A

        \[\leadsto \left(\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(b + a\right)\right) \cdot \frac{1}{\frac{1}{\color{blue}{b - a}}} \]
      12. lift--.f64N/A

        \[\leadsto \left(\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(b + a\right)\right) \cdot \frac{1}{\frac{1}{\color{blue}{b - a}}} \]
      13. un-div-invN/A

        \[\leadsto \color{blue}{\frac{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(b + a\right)}{\frac{1}{b - a}}} \]
      14. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(b + a\right)}{\frac{1}{b - a}}} \]
    7. Applied rewrites72.6%

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

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

Alternative 3: 64.2% accurate, 0.8× speedup?

\[\begin{array}{l} a_m = \left|a\right| \\ \begin{array}{l} t_0 := {b}^{2} - {a\_m}^{2}\\ t_1 := \sin \left(0.011111111111111112 \cdot \left(\pi \cdot angle\right)\right)\\ \mathbf{if}\;t\_0 \leq -\infty:\\ \;\;\;\;\left(a\_m + b\right) \cdot \left(\left(0.011111111111111112 \cdot angle\right) \cdot \left(\left(b - a\_m\right) \cdot \pi\right)\right)\\ \mathbf{elif}\;t\_0 \leq 4 \cdot 10^{-306}:\\ \;\;\;\;\left(a\_m + b\right) \cdot \left(t\_1 \cdot \left(-a\_m\right)\right)\\ \mathbf{else}:\\ \;\;\;\;b \cdot \left(b \cdot t\_1\right)\\ \end{array} \end{array} \]
a_m = (fabs.f64 a)
(FPCore (a_m b angle)
 :precision binary64
 (let* ((t_0 (- (pow b 2.0) (pow a_m 2.0)))
        (t_1 (sin (* 0.011111111111111112 (* PI angle)))))
   (if (<= t_0 (- INFINITY))
     (* (+ a_m b) (* (* 0.011111111111111112 angle) (* (- b a_m) PI)))
     (if (<= t_0 4e-306) (* (+ a_m b) (* t_1 (- a_m))) (* b (* b t_1))))))
a_m = fabs(a);
double code(double a_m, double b, double angle) {
	double t_0 = pow(b, 2.0) - pow(a_m, 2.0);
	double t_1 = sin((0.011111111111111112 * (((double) M_PI) * angle)));
	double tmp;
	if (t_0 <= -((double) INFINITY)) {
		tmp = (a_m + b) * ((0.011111111111111112 * angle) * ((b - a_m) * ((double) M_PI)));
	} else if (t_0 <= 4e-306) {
		tmp = (a_m + b) * (t_1 * -a_m);
	} else {
		tmp = b * (b * t_1);
	}
	return tmp;
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle) {
	double t_0 = Math.pow(b, 2.0) - Math.pow(a_m, 2.0);
	double t_1 = Math.sin((0.011111111111111112 * (Math.PI * angle)));
	double tmp;
	if (t_0 <= -Double.POSITIVE_INFINITY) {
		tmp = (a_m + b) * ((0.011111111111111112 * angle) * ((b - a_m) * Math.PI));
	} else if (t_0 <= 4e-306) {
		tmp = (a_m + b) * (t_1 * -a_m);
	} else {
		tmp = b * (b * t_1);
	}
	return tmp;
}
a_m = math.fabs(a)
def code(a_m, b, angle):
	t_0 = math.pow(b, 2.0) - math.pow(a_m, 2.0)
	t_1 = math.sin((0.011111111111111112 * (math.pi * angle)))
	tmp = 0
	if t_0 <= -math.inf:
		tmp = (a_m + b) * ((0.011111111111111112 * angle) * ((b - a_m) * math.pi))
	elif t_0 <= 4e-306:
		tmp = (a_m + b) * (t_1 * -a_m)
	else:
		tmp = b * (b * t_1)
	return tmp
a_m = abs(a)
function code(a_m, b, angle)
	t_0 = Float64((b ^ 2.0) - (a_m ^ 2.0))
	t_1 = sin(Float64(0.011111111111111112 * Float64(pi * angle)))
	tmp = 0.0
	if (t_0 <= Float64(-Inf))
		tmp = Float64(Float64(a_m + b) * Float64(Float64(0.011111111111111112 * angle) * Float64(Float64(b - a_m) * pi)));
	elseif (t_0 <= 4e-306)
		tmp = Float64(Float64(a_m + b) * Float64(t_1 * Float64(-a_m)));
	else
		tmp = Float64(b * Float64(b * t_1));
	end
	return tmp
end
a_m = abs(a);
function tmp_2 = code(a_m, b, angle)
	t_0 = (b ^ 2.0) - (a_m ^ 2.0);
	t_1 = sin((0.011111111111111112 * (pi * angle)));
	tmp = 0.0;
	if (t_0 <= -Inf)
		tmp = (a_m + b) * ((0.011111111111111112 * angle) * ((b - a_m) * pi));
	elseif (t_0 <= 4e-306)
		tmp = (a_m + b) * (t_1 * -a_m);
	else
		tmp = b * (b * t_1);
	end
	tmp_2 = tmp;
end
a_m = N[Abs[a], $MachinePrecision]
code[a$95$m_, b_, angle_] := Block[{t$95$0 = N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(0.011111111111111112 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(a$95$m + b), $MachinePrecision] * N[(N[(0.011111111111111112 * angle), $MachinePrecision] * N[(N[(b - a$95$m), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 4e-306], N[(N[(a$95$m + b), $MachinePrecision] * N[(t$95$1 * (-a$95$m)), $MachinePrecision]), $MachinePrecision], N[(b * N[(b * t$95$1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
a_m = \left|a\right|

\\
\begin{array}{l}
t_0 := {b}^{2} - {a\_m}^{2}\\
t_1 := \sin \left(0.011111111111111112 \cdot \left(\pi \cdot angle\right)\right)\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\left(a\_m + b\right) \cdot \left(\left(0.011111111111111112 \cdot angle\right) \cdot \left(\left(b - a\_m\right) \cdot \pi\right)\right)\\

\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{-306}:\\
\;\;\;\;\left(a\_m + b\right) \cdot \left(t\_1 \cdot \left(-a\_m\right)\right)\\

\mathbf{else}:\\
\;\;\;\;b \cdot \left(b \cdot t\_1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64))) < -inf.0

    1. Initial program 49.9%

      \[\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. Applied rewrites72.2%

      \[\leadsto \color{blue}{\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right)\right)} \]
    4. Taylor expanded in angle around 0

      \[\leadsto \left(b + a\right) \cdot \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot \left(b - a\right)\right)\right)\right)} \]
    5. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(b + a\right) \cdot \color{blue}{\left(\left(\frac{1}{90} \cdot angle\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(b - a\right)\right)\right)} \]
      2. lower-*.f64N/A

        \[\leadsto \left(b + a\right) \cdot \color{blue}{\left(\left(\frac{1}{90} \cdot angle\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(b - a\right)\right)\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\color{blue}{\left(\frac{1}{90} \cdot angle\right)} \cdot \left(\mathsf{PI}\left(\right) \cdot \left(b - a\right)\right)\right) \]
      4. lower-*.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\left(\frac{1}{90} \cdot angle\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \left(b - a\right)\right)}\right) \]
      5. lower-PI.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\left(\frac{1}{90} \cdot angle\right) \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \left(b - a\right)\right)\right) \]
      6. lower--.f6482.9

        \[\leadsto \left(b + a\right) \cdot \left(\left(0.011111111111111112 \cdot angle\right) \cdot \left(\pi \cdot \color{blue}{\left(b - a\right)}\right)\right) \]
    6. Applied rewrites82.9%

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

    if -inf.0 < (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64))) < 4.00000000000000011e-306

    1. Initial program 63.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. Applied rewrites64.2%

      \[\leadsto \color{blue}{\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right)\right)} \]
    4. Taylor expanded in b around 0

      \[\leadsto \left(b + a\right) \cdot \color{blue}{\left(-1 \cdot \left(a \cdot \sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)} \]
    5. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \left(b + a\right) \cdot \color{blue}{\left(\mathsf{neg}\left(a \cdot \sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)} \]
      2. *-commutativeN/A

        \[\leadsto \left(b + a\right) \cdot \left(\mathsf{neg}\left(\color{blue}{\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot a}\right)\right) \]
      3. distribute-rgt-neg-inN/A

        \[\leadsto \left(b + a\right) \cdot \color{blue}{\left(\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\mathsf{neg}\left(a\right)\right)\right)} \]
      4. mul-1-negN/A

        \[\leadsto \left(b + a\right) \cdot \left(\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\left(-1 \cdot a\right)}\right) \]
      5. lower-*.f64N/A

        \[\leadsto \left(b + a\right) \cdot \color{blue}{\left(\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(-1 \cdot a\right)\right)} \]
      6. lower-sin.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\color{blue}{\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot \left(-1 \cdot a\right)\right) \]
      7. lower-*.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\sin \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot \left(-1 \cdot a\right)\right) \]
      8. lower-*.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\sin \left(\frac{1}{90} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot \left(-1 \cdot a\right)\right) \]
      9. lower-PI.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\sin \left(\frac{1}{90} \cdot \left(angle \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \cdot \left(-1 \cdot a\right)\right) \]
      10. mul-1-negN/A

        \[\leadsto \left(b + a\right) \cdot \left(\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\left(\mathsf{neg}\left(a\right)\right)}\right) \]
      11. lower-neg.f6464.2

        \[\leadsto \left(b + a\right) \cdot \left(\sin \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot \color{blue}{\left(-a\right)}\right) \]
    6. Applied rewrites64.2%

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

    if 4.00000000000000011e-306 < (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))

    1. Initial program 45.3%

      \[\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. Applied rewrites59.2%

      \[\leadsto \color{blue}{\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right)\right)} \]
    4. Taylor expanded in b around inf

      \[\leadsto \color{blue}{{b}^{2} \cdot \sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \]
    5. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {b}^{2}} \]
      2. lower-*.f64N/A

        \[\leadsto \color{blue}{\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {b}^{2}} \]
      3. lower-sin.f64N/A

        \[\leadsto \color{blue}{\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot {b}^{2} \]
      4. lower-*.f64N/A

        \[\leadsto \sin \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot {b}^{2} \]
      5. lower-*.f64N/A

        \[\leadsto \sin \left(\frac{1}{90} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot {b}^{2} \]
      6. lower-PI.f64N/A

        \[\leadsto \sin \left(\frac{1}{90} \cdot \left(angle \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \cdot {b}^{2} \]
      7. unpow2N/A

        \[\leadsto \sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\left(b \cdot b\right)} \]
      8. lower-*.f6452.9

        \[\leadsto \sin \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot \color{blue}{\left(b \cdot b\right)} \]
    6. Applied rewrites52.9%

      \[\leadsto \color{blue}{\sin \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(b \cdot b\right)} \]
    7. Step-by-step derivation
      1. lift-PI.f64N/A

        \[\leadsto \sin \left(\frac{1}{90} \cdot \left(angle \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \cdot \left(b \cdot b\right) \]
      2. lift-*.f64N/A

        \[\leadsto \sin \left(\frac{1}{90} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot \left(b \cdot b\right) \]
      3. lift-*.f64N/A

        \[\leadsto \sin \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot \left(b \cdot b\right) \]
      4. lift-sin.f64N/A

        \[\leadsto \color{blue}{\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot \left(b \cdot b\right) \]
      5. associate-*r*N/A

        \[\leadsto \color{blue}{\left(\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot b\right) \cdot b} \]
      6. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot b\right) \cdot b} \]
      7. *-commutativeN/A

        \[\leadsto \color{blue}{\left(b \cdot \sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \cdot b \]
      8. lower-*.f6460.3

        \[\leadsto \color{blue}{\left(b \cdot \sin \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right)\right)} \cdot b \]
      9. lift-*.f64N/A

        \[\leadsto \left(b \cdot \sin \left(\frac{1}{90} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right)\right) \cdot b \]
      10. *-commutativeN/A

        \[\leadsto \left(b \cdot \sin \left(\frac{1}{90} \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot angle\right)}\right)\right) \cdot b \]
      11. lift-*.f6460.3

        \[\leadsto \left(b \cdot \sin \left(0.011111111111111112 \cdot \color{blue}{\left(\pi \cdot angle\right)}\right)\right) \cdot b \]
    8. Applied rewrites60.3%

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

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

Alternative 4: 64.3% accurate, 0.8× speedup?

\[\begin{array}{l} a_m = \left|a\right| \\ \begin{array}{l} t_0 := {b}^{2} - {a\_m}^{2}\\ t_1 := \sin \left(0.011111111111111112 \cdot \left(\pi \cdot angle\right)\right)\\ \mathbf{if}\;t\_0 \leq -\infty:\\ \;\;\;\;\left(a\_m + b\right) \cdot \left(\left(0.011111111111111112 \cdot angle\right) \cdot \left(\left(b - a\_m\right) \cdot \pi\right)\right)\\ \mathbf{elif}\;t\_0 \leq 4 \cdot 10^{-306}:\\ \;\;\;\;t\_1 \cdot \left(-a\_m \cdot a\_m\right)\\ \mathbf{else}:\\ \;\;\;\;b \cdot \left(b \cdot t\_1\right)\\ \end{array} \end{array} \]
a_m = (fabs.f64 a)
(FPCore (a_m b angle)
 :precision binary64
 (let* ((t_0 (- (pow b 2.0) (pow a_m 2.0)))
        (t_1 (sin (* 0.011111111111111112 (* PI angle)))))
   (if (<= t_0 (- INFINITY))
     (* (+ a_m b) (* (* 0.011111111111111112 angle) (* (- b a_m) PI)))
     (if (<= t_0 4e-306) (* t_1 (- (* a_m a_m))) (* b (* b t_1))))))
a_m = fabs(a);
double code(double a_m, double b, double angle) {
	double t_0 = pow(b, 2.0) - pow(a_m, 2.0);
	double t_1 = sin((0.011111111111111112 * (((double) M_PI) * angle)));
	double tmp;
	if (t_0 <= -((double) INFINITY)) {
		tmp = (a_m + b) * ((0.011111111111111112 * angle) * ((b - a_m) * ((double) M_PI)));
	} else if (t_0 <= 4e-306) {
		tmp = t_1 * -(a_m * a_m);
	} else {
		tmp = b * (b * t_1);
	}
	return tmp;
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle) {
	double t_0 = Math.pow(b, 2.0) - Math.pow(a_m, 2.0);
	double t_1 = Math.sin((0.011111111111111112 * (Math.PI * angle)));
	double tmp;
	if (t_0 <= -Double.POSITIVE_INFINITY) {
		tmp = (a_m + b) * ((0.011111111111111112 * angle) * ((b - a_m) * Math.PI));
	} else if (t_0 <= 4e-306) {
		tmp = t_1 * -(a_m * a_m);
	} else {
		tmp = b * (b * t_1);
	}
	return tmp;
}
a_m = math.fabs(a)
def code(a_m, b, angle):
	t_0 = math.pow(b, 2.0) - math.pow(a_m, 2.0)
	t_1 = math.sin((0.011111111111111112 * (math.pi * angle)))
	tmp = 0
	if t_0 <= -math.inf:
		tmp = (a_m + b) * ((0.011111111111111112 * angle) * ((b - a_m) * math.pi))
	elif t_0 <= 4e-306:
		tmp = t_1 * -(a_m * a_m)
	else:
		tmp = b * (b * t_1)
	return tmp
a_m = abs(a)
function code(a_m, b, angle)
	t_0 = Float64((b ^ 2.0) - (a_m ^ 2.0))
	t_1 = sin(Float64(0.011111111111111112 * Float64(pi * angle)))
	tmp = 0.0
	if (t_0 <= Float64(-Inf))
		tmp = Float64(Float64(a_m + b) * Float64(Float64(0.011111111111111112 * angle) * Float64(Float64(b - a_m) * pi)));
	elseif (t_0 <= 4e-306)
		tmp = Float64(t_1 * Float64(-Float64(a_m * a_m)));
	else
		tmp = Float64(b * Float64(b * t_1));
	end
	return tmp
end
a_m = abs(a);
function tmp_2 = code(a_m, b, angle)
	t_0 = (b ^ 2.0) - (a_m ^ 2.0);
	t_1 = sin((0.011111111111111112 * (pi * angle)));
	tmp = 0.0;
	if (t_0 <= -Inf)
		tmp = (a_m + b) * ((0.011111111111111112 * angle) * ((b - a_m) * pi));
	elseif (t_0 <= 4e-306)
		tmp = t_1 * -(a_m * a_m);
	else
		tmp = b * (b * t_1);
	end
	tmp_2 = tmp;
end
a_m = N[Abs[a], $MachinePrecision]
code[a$95$m_, b_, angle_] := Block[{t$95$0 = N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(0.011111111111111112 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(a$95$m + b), $MachinePrecision] * N[(N[(0.011111111111111112 * angle), $MachinePrecision] * N[(N[(b - a$95$m), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 4e-306], N[(t$95$1 * (-N[(a$95$m * a$95$m), $MachinePrecision])), $MachinePrecision], N[(b * N[(b * t$95$1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
a_m = \left|a\right|

\\
\begin{array}{l}
t_0 := {b}^{2} - {a\_m}^{2}\\
t_1 := \sin \left(0.011111111111111112 \cdot \left(\pi \cdot angle\right)\right)\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\left(a\_m + b\right) \cdot \left(\left(0.011111111111111112 \cdot angle\right) \cdot \left(\left(b - a\_m\right) \cdot \pi\right)\right)\\

\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{-306}:\\
\;\;\;\;t\_1 \cdot \left(-a\_m \cdot a\_m\right)\\

\mathbf{else}:\\
\;\;\;\;b \cdot \left(b \cdot t\_1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64))) < -inf.0

    1. Initial program 49.9%

      \[\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. Applied rewrites72.2%

      \[\leadsto \color{blue}{\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right)\right)} \]
    4. Taylor expanded in angle around 0

      \[\leadsto \left(b + a\right) \cdot \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot \left(b - a\right)\right)\right)\right)} \]
    5. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(b + a\right) \cdot \color{blue}{\left(\left(\frac{1}{90} \cdot angle\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(b - a\right)\right)\right)} \]
      2. lower-*.f64N/A

        \[\leadsto \left(b + a\right) \cdot \color{blue}{\left(\left(\frac{1}{90} \cdot angle\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(b - a\right)\right)\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\color{blue}{\left(\frac{1}{90} \cdot angle\right)} \cdot \left(\mathsf{PI}\left(\right) \cdot \left(b - a\right)\right)\right) \]
      4. lower-*.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\left(\frac{1}{90} \cdot angle\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \left(b - a\right)\right)}\right) \]
      5. lower-PI.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\left(\frac{1}{90} \cdot angle\right) \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \left(b - a\right)\right)\right) \]
      6. lower--.f6482.9

        \[\leadsto \left(b + a\right) \cdot \left(\left(0.011111111111111112 \cdot angle\right) \cdot \left(\pi \cdot \color{blue}{\left(b - a\right)}\right)\right) \]
    6. Applied rewrites82.9%

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

    if -inf.0 < (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64))) < 4.00000000000000011e-306

    1. Initial program 63.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. Applied rewrites64.2%

      \[\leadsto \color{blue}{\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right)\right)} \]
    4. Taylor expanded in b around 0

      \[\leadsto \color{blue}{-1 \cdot \left({a}^{2} \cdot \sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
    5. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \color{blue}{\mathsf{neg}\left({a}^{2} \cdot \sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
      2. lower-neg.f64N/A

        \[\leadsto \color{blue}{\mathsf{neg}\left({a}^{2} \cdot \sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \mathsf{neg}\left(\color{blue}{{a}^{2} \cdot \sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{neg}\left(\color{blue}{\left(a \cdot a\right)} \cdot \sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      5. lower-*.f64N/A

        \[\leadsto \mathsf{neg}\left(\color{blue}{\left(a \cdot a\right)} \cdot \sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      6. lower-sin.f64N/A

        \[\leadsto \mathsf{neg}\left(\left(a \cdot a\right) \cdot \color{blue}{\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
      7. lower-*.f64N/A

        \[\leadsto \mathsf{neg}\left(\left(a \cdot a\right) \cdot \sin \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
      8. lower-*.f64N/A

        \[\leadsto \mathsf{neg}\left(\left(a \cdot a\right) \cdot \sin \left(\frac{1}{90} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right)\right) \]
      9. lower-PI.f6464.2

        \[\leadsto -\left(a \cdot a\right) \cdot \sin \left(0.011111111111111112 \cdot \left(angle \cdot \color{blue}{\pi}\right)\right) \]
    6. Applied rewrites64.2%

      \[\leadsto \color{blue}{-\left(a \cdot a\right) \cdot \sin \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right)} \]

    if 4.00000000000000011e-306 < (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))

    1. Initial program 45.3%

      \[\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. Applied rewrites59.2%

      \[\leadsto \color{blue}{\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right)\right)} \]
    4. Taylor expanded in b around inf

      \[\leadsto \color{blue}{{b}^{2} \cdot \sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \]
    5. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {b}^{2}} \]
      2. lower-*.f64N/A

        \[\leadsto \color{blue}{\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {b}^{2}} \]
      3. lower-sin.f64N/A

        \[\leadsto \color{blue}{\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot {b}^{2} \]
      4. lower-*.f64N/A

        \[\leadsto \sin \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot {b}^{2} \]
      5. lower-*.f64N/A

        \[\leadsto \sin \left(\frac{1}{90} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot {b}^{2} \]
      6. lower-PI.f64N/A

        \[\leadsto \sin \left(\frac{1}{90} \cdot \left(angle \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \cdot {b}^{2} \]
      7. unpow2N/A

        \[\leadsto \sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\left(b \cdot b\right)} \]
      8. lower-*.f6452.9

        \[\leadsto \sin \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot \color{blue}{\left(b \cdot b\right)} \]
    6. Applied rewrites52.9%

      \[\leadsto \color{blue}{\sin \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(b \cdot b\right)} \]
    7. Step-by-step derivation
      1. lift-PI.f64N/A

        \[\leadsto \sin \left(\frac{1}{90} \cdot \left(angle \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \cdot \left(b \cdot b\right) \]
      2. lift-*.f64N/A

        \[\leadsto \sin \left(\frac{1}{90} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot \left(b \cdot b\right) \]
      3. lift-*.f64N/A

        \[\leadsto \sin \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot \left(b \cdot b\right) \]
      4. lift-sin.f64N/A

        \[\leadsto \color{blue}{\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot \left(b \cdot b\right) \]
      5. associate-*r*N/A

        \[\leadsto \color{blue}{\left(\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot b\right) \cdot b} \]
      6. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot b\right) \cdot b} \]
      7. *-commutativeN/A

        \[\leadsto \color{blue}{\left(b \cdot \sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \cdot b \]
      8. lower-*.f6460.3

        \[\leadsto \color{blue}{\left(b \cdot \sin \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right)\right)} \cdot b \]
      9. lift-*.f64N/A

        \[\leadsto \left(b \cdot \sin \left(\frac{1}{90} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right)\right) \cdot b \]
      10. *-commutativeN/A

        \[\leadsto \left(b \cdot \sin \left(\frac{1}{90} \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot angle\right)}\right)\right) \cdot b \]
      11. lift-*.f6460.3

        \[\leadsto \left(b \cdot \sin \left(0.011111111111111112 \cdot \color{blue}{\left(\pi \cdot angle\right)}\right)\right) \cdot b \]
    8. Applied rewrites60.3%

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

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

Alternative 5: 62.8% accurate, 1.4× speedup?

\[\begin{array}{l} a_m = \left|a\right| \\ \begin{array}{l} \mathbf{if}\;{b}^{2} - {a\_m}^{2} \leq -5 \cdot 10^{-244}:\\ \;\;\;\;\left(a\_m \cdot -0.011111111111111112\right) \cdot \left(a\_m \cdot \left(\pi \cdot angle\right)\right)\\ \mathbf{else}:\\ \;\;\;\;b \cdot \left(b \cdot \sin \left(0.011111111111111112 \cdot \left(\pi \cdot angle\right)\right)\right)\\ \end{array} \end{array} \]
a_m = (fabs.f64 a)
(FPCore (a_m b angle)
 :precision binary64
 (if (<= (- (pow b 2.0) (pow a_m 2.0)) -5e-244)
   (* (* a_m -0.011111111111111112) (* a_m (* PI angle)))
   (* b (* b (sin (* 0.011111111111111112 (* PI angle)))))))
a_m = fabs(a);
double code(double a_m, double b, double angle) {
	double tmp;
	if ((pow(b, 2.0) - pow(a_m, 2.0)) <= -5e-244) {
		tmp = (a_m * -0.011111111111111112) * (a_m * (((double) M_PI) * angle));
	} else {
		tmp = b * (b * sin((0.011111111111111112 * (((double) M_PI) * angle))));
	}
	return tmp;
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle) {
	double tmp;
	if ((Math.pow(b, 2.0) - Math.pow(a_m, 2.0)) <= -5e-244) {
		tmp = (a_m * -0.011111111111111112) * (a_m * (Math.PI * angle));
	} else {
		tmp = b * (b * Math.sin((0.011111111111111112 * (Math.PI * angle))));
	}
	return tmp;
}
a_m = math.fabs(a)
def code(a_m, b, angle):
	tmp = 0
	if (math.pow(b, 2.0) - math.pow(a_m, 2.0)) <= -5e-244:
		tmp = (a_m * -0.011111111111111112) * (a_m * (math.pi * angle))
	else:
		tmp = b * (b * math.sin((0.011111111111111112 * (math.pi * angle))))
	return tmp
a_m = abs(a)
function code(a_m, b, angle)
	tmp = 0.0
	if (Float64((b ^ 2.0) - (a_m ^ 2.0)) <= -5e-244)
		tmp = Float64(Float64(a_m * -0.011111111111111112) * Float64(a_m * Float64(pi * angle)));
	else
		tmp = Float64(b * Float64(b * sin(Float64(0.011111111111111112 * Float64(pi * angle)))));
	end
	return tmp
end
a_m = abs(a);
function tmp_2 = code(a_m, b, angle)
	tmp = 0.0;
	if (((b ^ 2.0) - (a_m ^ 2.0)) <= -5e-244)
		tmp = (a_m * -0.011111111111111112) * (a_m * (pi * angle));
	else
		tmp = b * (b * sin((0.011111111111111112 * (pi * angle))));
	end
	tmp_2 = tmp;
end
a_m = N[Abs[a], $MachinePrecision]
code[a$95$m_, b_, angle_] := If[LessEqual[N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a$95$m, 2.0], $MachinePrecision]), $MachinePrecision], -5e-244], N[(N[(a$95$m * -0.011111111111111112), $MachinePrecision] * N[(a$95$m * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(b * N[(b * N[Sin[N[(0.011111111111111112 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|

\\
\begin{array}{l}
\mathbf{if}\;{b}^{2} - {a\_m}^{2} \leq -5 \cdot 10^{-244}:\\
\;\;\;\;\left(a\_m \cdot -0.011111111111111112\right) \cdot \left(a\_m \cdot \left(\pi \cdot angle\right)\right)\\

\mathbf{else}:\\
\;\;\;\;b \cdot \left(b \cdot \sin \left(0.011111111111111112 \cdot \left(\pi \cdot angle\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64))) < -4.99999999999999998e-244

    1. Initial program 53.2%

      \[\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in angle around 0

      \[\leadsto \color{blue}{\frac{1}{90} \cdot \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \frac{1}{90} \cdot \color{blue}{\left(\left(angle \cdot \mathsf{PI}\left(\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)} \]
      2. associate-*r*N/A

        \[\leadsto \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot \left({b}^{2} - {a}^{2}\right) \]
      5. lower-*.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot \left({b}^{2} - {a}^{2}\right) \]
      6. lower-PI.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \cdot \left({b}^{2} - {a}^{2}\right) \]
      7. unpow2N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\color{blue}{b \cdot b} - {a}^{2}\right) \]
      8. unpow2N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(b \cdot b - \color{blue}{a \cdot a}\right) \]
      9. difference-of-squaresN/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \]
      10. lower-*.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \]
      11. lower-+.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\color{blue}{\left(b + a\right)} \cdot \left(b - a\right)\right) \]
      12. lower--.f6456.2

        \[\leadsto \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(\left(b + a\right) \cdot \color{blue}{\left(b - a\right)}\right) \]
    5. Applied rewrites56.2%

      \[\leadsto \color{blue}{\left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)} \]
    6. Taylor expanded in b around 0

      \[\leadsto \color{blue}{\frac{-1}{90} \cdot \left({a}^{2} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \]
    7. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \color{blue}{\left(\frac{-1}{90} \cdot {a}^{2}\right) \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)} \]
      2. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{-1}{90} \cdot {a}^{2}\right) \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{-1}{90} \cdot {a}^{2}\right)} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right) \]
      4. unpow2N/A

        \[\leadsto \left(\frac{-1}{90} \cdot \color{blue}{\left(a \cdot a\right)}\right) \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right) \]
      5. lower-*.f64N/A

        \[\leadsto \left(\frac{-1}{90} \cdot \color{blue}{\left(a \cdot a\right)}\right) \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right) \]
      6. lower-*.f64N/A

        \[\leadsto \left(\frac{-1}{90} \cdot \left(a \cdot a\right)\right) \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)} \]
      7. lower-PI.f6456.0

        \[\leadsto \left(-0.011111111111111112 \cdot \left(a \cdot a\right)\right) \cdot \left(angle \cdot \color{blue}{\pi}\right) \]
    8. Applied rewrites56.0%

      \[\leadsto \color{blue}{\left(-0.011111111111111112 \cdot \left(a \cdot a\right)\right) \cdot \left(angle \cdot \pi\right)} \]
    9. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \color{blue}{\left(\left(\frac{-1}{90} \cdot a\right) \cdot a\right)} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right) \]
      2. lift-PI.f64N/A

        \[\leadsto \left(\left(\frac{-1}{90} \cdot a\right) \cdot a\right) \cdot \left(angle \cdot \color{blue}{\mathsf{PI}\left(\right)}\right) \]
      3. lift-*.f64N/A

        \[\leadsto \left(\left(\frac{-1}{90} \cdot a\right) \cdot a\right) \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)} \]
      4. associate-*l*N/A

        \[\leadsto \color{blue}{\left(\frac{-1}{90} \cdot a\right) \cdot \left(a \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \]
      5. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{-1}{90} \cdot a\right) \cdot \left(a \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \]
      6. *-commutativeN/A

        \[\leadsto \color{blue}{\left(a \cdot \frac{-1}{90}\right)} \cdot \left(a \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \]
      7. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(a \cdot \frac{-1}{90}\right)} \cdot \left(a \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \]
      8. lower-*.f6464.1

        \[\leadsto \left(a \cdot -0.011111111111111112\right) \cdot \color{blue}{\left(a \cdot \left(angle \cdot \pi\right)\right)} \]
      9. lift-*.f64N/A

        \[\leadsto \left(a \cdot \frac{-1}{90}\right) \cdot \left(a \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right) \]
      10. *-commutativeN/A

        \[\leadsto \left(a \cdot \frac{-1}{90}\right) \cdot \left(a \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot angle\right)}\right) \]
      11. lift-*.f6464.1

        \[\leadsto \left(a \cdot -0.011111111111111112\right) \cdot \left(a \cdot \color{blue}{\left(\pi \cdot angle\right)}\right) \]
    10. Applied rewrites64.1%

      \[\leadsto \color{blue}{\left(a \cdot -0.011111111111111112\right) \cdot \left(a \cdot \left(\pi \cdot angle\right)\right)} \]

    if -4.99999999999999998e-244 < (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))

    1. Initial program 51.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. Applied rewrites63.2%

      \[\leadsto \color{blue}{\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right)\right)} \]
    4. Taylor expanded in b around inf

      \[\leadsto \color{blue}{{b}^{2} \cdot \sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \]
    5. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {b}^{2}} \]
      2. lower-*.f64N/A

        \[\leadsto \color{blue}{\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {b}^{2}} \]
      3. lower-sin.f64N/A

        \[\leadsto \color{blue}{\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot {b}^{2} \]
      4. lower-*.f64N/A

        \[\leadsto \sin \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot {b}^{2} \]
      5. lower-*.f64N/A

        \[\leadsto \sin \left(\frac{1}{90} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot {b}^{2} \]
      6. lower-PI.f64N/A

        \[\leadsto \sin \left(\frac{1}{90} \cdot \left(angle \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \cdot {b}^{2} \]
      7. unpow2N/A

        \[\leadsto \sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\left(b \cdot b\right)} \]
      8. lower-*.f6457.6

        \[\leadsto \sin \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot \color{blue}{\left(b \cdot b\right)} \]
    6. Applied rewrites57.6%

      \[\leadsto \color{blue}{\sin \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(b \cdot b\right)} \]
    7. Step-by-step derivation
      1. lift-PI.f64N/A

        \[\leadsto \sin \left(\frac{1}{90} \cdot \left(angle \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \cdot \left(b \cdot b\right) \]
      2. lift-*.f64N/A

        \[\leadsto \sin \left(\frac{1}{90} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot \left(b \cdot b\right) \]
      3. lift-*.f64N/A

        \[\leadsto \sin \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot \left(b \cdot b\right) \]
      4. lift-sin.f64N/A

        \[\leadsto \color{blue}{\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot \left(b \cdot b\right) \]
      5. associate-*r*N/A

        \[\leadsto \color{blue}{\left(\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot b\right) \cdot b} \]
      6. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot b\right) \cdot b} \]
      7. *-commutativeN/A

        \[\leadsto \color{blue}{\left(b \cdot \sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \cdot b \]
      8. lower-*.f6463.8

        \[\leadsto \color{blue}{\left(b \cdot \sin \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right)\right)} \cdot b \]
      9. lift-*.f64N/A

        \[\leadsto \left(b \cdot \sin \left(\frac{1}{90} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right)\right) \cdot b \]
      10. *-commutativeN/A

        \[\leadsto \left(b \cdot \sin \left(\frac{1}{90} \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot angle\right)}\right)\right) \cdot b \]
      11. lift-*.f6463.8

        \[\leadsto \left(b \cdot \sin \left(0.011111111111111112 \cdot \color{blue}{\left(\pi \cdot angle\right)}\right)\right) \cdot b \]
    8. Applied rewrites63.8%

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

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

Alternative 6: 59.6% accurate, 2.0× speedup?

\[\begin{array}{l} a_m = \left|a\right| \\ \begin{array}{l} \mathbf{if}\;{b}^{2} - {a\_m}^{2} \leq 0:\\ \;\;\;\;\left(a\_m \cdot -0.011111111111111112\right) \cdot \left(a\_m \cdot \left(\pi \cdot angle\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.011111111111111112 \cdot \left(b \cdot \left(b \cdot \left(\pi \cdot angle\right)\right)\right)\\ \end{array} \end{array} \]
a_m = (fabs.f64 a)
(FPCore (a_m b angle)
 :precision binary64
 (if (<= (- (pow b 2.0) (pow a_m 2.0)) 0.0)
   (* (* a_m -0.011111111111111112) (* a_m (* PI angle)))
   (* 0.011111111111111112 (* b (* b (* PI angle))))))
a_m = fabs(a);
double code(double a_m, double b, double angle) {
	double tmp;
	if ((pow(b, 2.0) - pow(a_m, 2.0)) <= 0.0) {
		tmp = (a_m * -0.011111111111111112) * (a_m * (((double) M_PI) * angle));
	} else {
		tmp = 0.011111111111111112 * (b * (b * (((double) M_PI) * angle)));
	}
	return tmp;
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle) {
	double tmp;
	if ((Math.pow(b, 2.0) - Math.pow(a_m, 2.0)) <= 0.0) {
		tmp = (a_m * -0.011111111111111112) * (a_m * (Math.PI * angle));
	} else {
		tmp = 0.011111111111111112 * (b * (b * (Math.PI * angle)));
	}
	return tmp;
}
a_m = math.fabs(a)
def code(a_m, b, angle):
	tmp = 0
	if (math.pow(b, 2.0) - math.pow(a_m, 2.0)) <= 0.0:
		tmp = (a_m * -0.011111111111111112) * (a_m * (math.pi * angle))
	else:
		tmp = 0.011111111111111112 * (b * (b * (math.pi * angle)))
	return tmp
a_m = abs(a)
function code(a_m, b, angle)
	tmp = 0.0
	if (Float64((b ^ 2.0) - (a_m ^ 2.0)) <= 0.0)
		tmp = Float64(Float64(a_m * -0.011111111111111112) * Float64(a_m * Float64(pi * angle)));
	else
		tmp = Float64(0.011111111111111112 * Float64(b * Float64(b * Float64(pi * angle))));
	end
	return tmp
end
a_m = abs(a);
function tmp_2 = code(a_m, b, angle)
	tmp = 0.0;
	if (((b ^ 2.0) - (a_m ^ 2.0)) <= 0.0)
		tmp = (a_m * -0.011111111111111112) * (a_m * (pi * angle));
	else
		tmp = 0.011111111111111112 * (b * (b * (pi * angle)));
	end
	tmp_2 = tmp;
end
a_m = N[Abs[a], $MachinePrecision]
code[a$95$m_, b_, angle_] := If[LessEqual[N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a$95$m, 2.0], $MachinePrecision]), $MachinePrecision], 0.0], N[(N[(a$95$m * -0.011111111111111112), $MachinePrecision] * N[(a$95$m * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.011111111111111112 * N[(b * N[(b * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|

\\
\begin{array}{l}
\mathbf{if}\;{b}^{2} - {a\_m}^{2} \leq 0:\\
\;\;\;\;\left(a\_m \cdot -0.011111111111111112\right) \cdot \left(a\_m \cdot \left(\pi \cdot angle\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64))) < 0.0

    1. Initial program 59.2%

      \[\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in angle around 0

      \[\leadsto \color{blue}{\frac{1}{90} \cdot \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \frac{1}{90} \cdot \color{blue}{\left(\left(angle \cdot \mathsf{PI}\left(\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)} \]
      2. associate-*r*N/A

        \[\leadsto \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot \left({b}^{2} - {a}^{2}\right) \]
      5. lower-*.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot \left({b}^{2} - {a}^{2}\right) \]
      6. lower-PI.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \cdot \left({b}^{2} - {a}^{2}\right) \]
      7. unpow2N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\color{blue}{b \cdot b} - {a}^{2}\right) \]
      8. unpow2N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(b \cdot b - \color{blue}{a \cdot a}\right) \]
      9. difference-of-squaresN/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \]
      10. lower-*.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \]
      11. lower-+.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\color{blue}{\left(b + a\right)} \cdot \left(b - a\right)\right) \]
      12. lower--.f6461.0

        \[\leadsto \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(\left(b + a\right) \cdot \color{blue}{\left(b - a\right)}\right) \]
    5. Applied rewrites61.0%

      \[\leadsto \color{blue}{\left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)} \]
    6. Taylor expanded in b around 0

      \[\leadsto \color{blue}{\frac{-1}{90} \cdot \left({a}^{2} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \]
    7. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \color{blue}{\left(\frac{-1}{90} \cdot {a}^{2}\right) \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)} \]
      2. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{-1}{90} \cdot {a}^{2}\right) \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{-1}{90} \cdot {a}^{2}\right)} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right) \]
      4. unpow2N/A

        \[\leadsto \left(\frac{-1}{90} \cdot \color{blue}{\left(a \cdot a\right)}\right) \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right) \]
      5. lower-*.f64N/A

        \[\leadsto \left(\frac{-1}{90} \cdot \color{blue}{\left(a \cdot a\right)}\right) \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right) \]
      6. lower-*.f64N/A

        \[\leadsto \left(\frac{-1}{90} \cdot \left(a \cdot a\right)\right) \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)} \]
      7. lower-PI.f6460.9

        \[\leadsto \left(-0.011111111111111112 \cdot \left(a \cdot a\right)\right) \cdot \left(angle \cdot \color{blue}{\pi}\right) \]
    8. Applied rewrites60.9%

      \[\leadsto \color{blue}{\left(-0.011111111111111112 \cdot \left(a \cdot a\right)\right) \cdot \left(angle \cdot \pi\right)} \]
    9. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \color{blue}{\left(\left(\frac{-1}{90} \cdot a\right) \cdot a\right)} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right) \]
      2. lift-PI.f64N/A

        \[\leadsto \left(\left(\frac{-1}{90} \cdot a\right) \cdot a\right) \cdot \left(angle \cdot \color{blue}{\mathsf{PI}\left(\right)}\right) \]
      3. lift-*.f64N/A

        \[\leadsto \left(\left(\frac{-1}{90} \cdot a\right) \cdot a\right) \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)} \]
      4. associate-*l*N/A

        \[\leadsto \color{blue}{\left(\frac{-1}{90} \cdot a\right) \cdot \left(a \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \]
      5. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{-1}{90} \cdot a\right) \cdot \left(a \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \]
      6. *-commutativeN/A

        \[\leadsto \color{blue}{\left(a \cdot \frac{-1}{90}\right)} \cdot \left(a \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \]
      7. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(a \cdot \frac{-1}{90}\right)} \cdot \left(a \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \]
      8. lower-*.f6464.9

        \[\leadsto \left(a \cdot -0.011111111111111112\right) \cdot \color{blue}{\left(a \cdot \left(angle \cdot \pi\right)\right)} \]
      9. lift-*.f64N/A

        \[\leadsto \left(a \cdot \frac{-1}{90}\right) \cdot \left(a \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right) \]
      10. *-commutativeN/A

        \[\leadsto \left(a \cdot \frac{-1}{90}\right) \cdot \left(a \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot angle\right)}\right) \]
      11. lift-*.f6464.9

        \[\leadsto \left(a \cdot -0.011111111111111112\right) \cdot \left(a \cdot \color{blue}{\left(\pi \cdot angle\right)}\right) \]
    10. Applied rewrites64.9%

      \[\leadsto \color{blue}{\left(a \cdot -0.011111111111111112\right) \cdot \left(a \cdot \left(\pi \cdot angle\right)\right)} \]

    if 0.0 < (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))

    1. Initial program 45.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. Applied rewrites58.8%

      \[\leadsto \color{blue}{\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right)\right)} \]
    4. Taylor expanded in b around inf

      \[\leadsto \color{blue}{{b}^{2} \cdot \sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \]
    5. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {b}^{2}} \]
      2. lower-*.f64N/A

        \[\leadsto \color{blue}{\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {b}^{2}} \]
      3. lower-sin.f64N/A

        \[\leadsto \color{blue}{\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot {b}^{2} \]
      4. lower-*.f64N/A

        \[\leadsto \sin \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot {b}^{2} \]
      5. lower-*.f64N/A

        \[\leadsto \sin \left(\frac{1}{90} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot {b}^{2} \]
      6. lower-PI.f64N/A

        \[\leadsto \sin \left(\frac{1}{90} \cdot \left(angle \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \cdot {b}^{2} \]
      7. unpow2N/A

        \[\leadsto \sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\left(b \cdot b\right)} \]
      8. lower-*.f6452.6

        \[\leadsto \sin \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot \color{blue}{\left(b \cdot b\right)} \]
    6. Applied rewrites52.6%

      \[\leadsto \color{blue}{\sin \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(b \cdot b\right)} \]
    7. Taylor expanded in angle around 0

      \[\leadsto \color{blue}{\frac{1}{90} \cdot \left(angle \cdot \left({b}^{2} \cdot \mathsf{PI}\left(\right)\right)\right)} \]
    8. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{1}{90} \cdot \left(angle \cdot \left({b}^{2} \cdot \mathsf{PI}\left(\right)\right)\right)} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{1}{90} \cdot \color{blue}{\left(angle \cdot \left({b}^{2} \cdot \mathsf{PI}\left(\right)\right)\right)} \]
      3. *-commutativeN/A

        \[\leadsto \frac{1}{90} \cdot \left(angle \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot {b}^{2}\right)}\right) \]
      4. lower-*.f64N/A

        \[\leadsto \frac{1}{90} \cdot \left(angle \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot {b}^{2}\right)}\right) \]
      5. lower-PI.f64N/A

        \[\leadsto \frac{1}{90} \cdot \left(angle \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot {b}^{2}\right)\right) \]
      6. unpow2N/A

        \[\leadsto \frac{1}{90} \cdot \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(b \cdot b\right)}\right)\right) \]
      7. lower-*.f6449.3

        \[\leadsto 0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \color{blue}{\left(b \cdot b\right)}\right)\right) \]
    9. Applied rewrites49.3%

      \[\leadsto \color{blue}{0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \left(b \cdot b\right)\right)\right)} \]
    10. Step-by-step derivation
      1. lift-PI.f64N/A

        \[\leadsto \frac{1}{90} \cdot \left(angle \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \left(b \cdot b\right)\right)\right) \]
      2. lift-*.f64N/A

        \[\leadsto \frac{1}{90} \cdot \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(b \cdot b\right)}\right)\right) \]
      3. associate-*r*N/A

        \[\leadsto \frac{1}{90} \cdot \color{blue}{\left(\left(angle \cdot \mathsf{PI}\left(\right)\right) \cdot \left(b \cdot b\right)\right)} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{1}{90} \cdot \left(\color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)} \cdot \left(b \cdot b\right)\right) \]
      5. lift-*.f64N/A

        \[\leadsto \frac{1}{90} \cdot \left(\left(angle \cdot \mathsf{PI}\left(\right)\right) \cdot \color{blue}{\left(b \cdot b\right)}\right) \]
      6. associate-*r*N/A

        \[\leadsto \frac{1}{90} \cdot \color{blue}{\left(\left(\left(angle \cdot \mathsf{PI}\left(\right)\right) \cdot b\right) \cdot b\right)} \]
      7. lower-*.f64N/A

        \[\leadsto \frac{1}{90} \cdot \color{blue}{\left(\left(\left(angle \cdot \mathsf{PI}\left(\right)\right) \cdot b\right) \cdot b\right)} \]
      8. lower-*.f6456.6

        \[\leadsto 0.011111111111111112 \cdot \left(\color{blue}{\left(\left(angle \cdot \pi\right) \cdot b\right)} \cdot b\right) \]
      9. lift-*.f64N/A

        \[\leadsto \frac{1}{90} \cdot \left(\left(\color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)} \cdot b\right) \cdot b\right) \]
      10. *-commutativeN/A

        \[\leadsto \frac{1}{90} \cdot \left(\left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot angle\right)} \cdot b\right) \cdot b\right) \]
      11. lift-*.f6456.6

        \[\leadsto 0.011111111111111112 \cdot \left(\left(\color{blue}{\left(\pi \cdot angle\right)} \cdot b\right) \cdot b\right) \]
    11. Applied rewrites56.6%

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

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

Alternative 7: 56.4% accurate, 2.0× speedup?

\[\begin{array}{l} a_m = \left|a\right| \\ \begin{array}{l} \mathbf{if}\;{b}^{2} - {a\_m}^{2} \leq 0:\\ \;\;\;\;\pi \cdot \left(-0.011111111111111112 \cdot \left(angle \cdot \left(a\_m \cdot a\_m\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.011111111111111112 \cdot \left(b \cdot \left(b \cdot \left(\pi \cdot angle\right)\right)\right)\\ \end{array} \end{array} \]
a_m = (fabs.f64 a)
(FPCore (a_m b angle)
 :precision binary64
 (if (<= (- (pow b 2.0) (pow a_m 2.0)) 0.0)
   (* PI (* -0.011111111111111112 (* angle (* a_m a_m))))
   (* 0.011111111111111112 (* b (* b (* PI angle))))))
a_m = fabs(a);
double code(double a_m, double b, double angle) {
	double tmp;
	if ((pow(b, 2.0) - pow(a_m, 2.0)) <= 0.0) {
		tmp = ((double) M_PI) * (-0.011111111111111112 * (angle * (a_m * a_m)));
	} else {
		tmp = 0.011111111111111112 * (b * (b * (((double) M_PI) * angle)));
	}
	return tmp;
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle) {
	double tmp;
	if ((Math.pow(b, 2.0) - Math.pow(a_m, 2.0)) <= 0.0) {
		tmp = Math.PI * (-0.011111111111111112 * (angle * (a_m * a_m)));
	} else {
		tmp = 0.011111111111111112 * (b * (b * (Math.PI * angle)));
	}
	return tmp;
}
a_m = math.fabs(a)
def code(a_m, b, angle):
	tmp = 0
	if (math.pow(b, 2.0) - math.pow(a_m, 2.0)) <= 0.0:
		tmp = math.pi * (-0.011111111111111112 * (angle * (a_m * a_m)))
	else:
		tmp = 0.011111111111111112 * (b * (b * (math.pi * angle)))
	return tmp
a_m = abs(a)
function code(a_m, b, angle)
	tmp = 0.0
	if (Float64((b ^ 2.0) - (a_m ^ 2.0)) <= 0.0)
		tmp = Float64(pi * Float64(-0.011111111111111112 * Float64(angle * Float64(a_m * a_m))));
	else
		tmp = Float64(0.011111111111111112 * Float64(b * Float64(b * Float64(pi * angle))));
	end
	return tmp
end
a_m = abs(a);
function tmp_2 = code(a_m, b, angle)
	tmp = 0.0;
	if (((b ^ 2.0) - (a_m ^ 2.0)) <= 0.0)
		tmp = pi * (-0.011111111111111112 * (angle * (a_m * a_m)));
	else
		tmp = 0.011111111111111112 * (b * (b * (pi * angle)));
	end
	tmp_2 = tmp;
end
a_m = N[Abs[a], $MachinePrecision]
code[a$95$m_, b_, angle_] := If[LessEqual[N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a$95$m, 2.0], $MachinePrecision]), $MachinePrecision], 0.0], N[(Pi * N[(-0.011111111111111112 * N[(angle * N[(a$95$m * a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.011111111111111112 * N[(b * N[(b * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|

\\
\begin{array}{l}
\mathbf{if}\;{b}^{2} - {a\_m}^{2} \leq 0:\\
\;\;\;\;\pi \cdot \left(-0.011111111111111112 \cdot \left(angle \cdot \left(a\_m \cdot a\_m\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64))) < 0.0

    1. Initial program 59.2%

      \[\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in angle around 0

      \[\leadsto \color{blue}{\frac{1}{90} \cdot \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \frac{1}{90} \cdot \color{blue}{\left(\left(angle \cdot \mathsf{PI}\left(\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)} \]
      2. associate-*r*N/A

        \[\leadsto \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot \left({b}^{2} - {a}^{2}\right) \]
      5. lower-*.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot \left({b}^{2} - {a}^{2}\right) \]
      6. lower-PI.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \cdot \left({b}^{2} - {a}^{2}\right) \]
      7. unpow2N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\color{blue}{b \cdot b} - {a}^{2}\right) \]
      8. unpow2N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(b \cdot b - \color{blue}{a \cdot a}\right) \]
      9. difference-of-squaresN/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \]
      10. lower-*.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \]
      11. lower-+.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\color{blue}{\left(b + a\right)} \cdot \left(b - a\right)\right) \]
      12. lower--.f6461.0

        \[\leadsto \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(\left(b + a\right) \cdot \color{blue}{\left(b - a\right)}\right) \]
    5. Applied rewrites61.0%

      \[\leadsto \color{blue}{\left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)} \]
    6. Taylor expanded in b around 0

      \[\leadsto \color{blue}{\frac{-1}{90} \cdot \left({a}^{2} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \]
    7. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \color{blue}{\left(\frac{-1}{90} \cdot {a}^{2}\right) \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)} \]
      2. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{-1}{90} \cdot {a}^{2}\right) \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{-1}{90} \cdot {a}^{2}\right)} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right) \]
      4. unpow2N/A

        \[\leadsto \left(\frac{-1}{90} \cdot \color{blue}{\left(a \cdot a\right)}\right) \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right) \]
      5. lower-*.f64N/A

        \[\leadsto \left(\frac{-1}{90} \cdot \color{blue}{\left(a \cdot a\right)}\right) \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right) \]
      6. lower-*.f64N/A

        \[\leadsto \left(\frac{-1}{90} \cdot \left(a \cdot a\right)\right) \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)} \]
      7. lower-PI.f6460.9

        \[\leadsto \left(-0.011111111111111112 \cdot \left(a \cdot a\right)\right) \cdot \left(angle \cdot \color{blue}{\pi}\right) \]
    8. Applied rewrites60.9%

      \[\leadsto \color{blue}{\left(-0.011111111111111112 \cdot \left(a \cdot a\right)\right) \cdot \left(angle \cdot \pi\right)} \]
    9. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(\frac{-1}{90} \cdot \color{blue}{\left(a \cdot a\right)}\right) \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right) \]
      2. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{-1}{90} \cdot \left(a \cdot a\right)\right)} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right) \]
      3. lift-PI.f64N/A

        \[\leadsto \left(\frac{-1}{90} \cdot \left(a \cdot a\right)\right) \cdot \left(angle \cdot \color{blue}{\mathsf{PI}\left(\right)}\right) \]
      4. associate-*r*N/A

        \[\leadsto \color{blue}{\left(\left(\frac{-1}{90} \cdot \left(a \cdot a\right)\right) \cdot angle\right) \cdot \mathsf{PI}\left(\right)} \]
      5. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\left(\frac{-1}{90} \cdot \left(a \cdot a\right)\right) \cdot angle\right) \cdot \mathsf{PI}\left(\right)} \]
      6. lift-*.f64N/A

        \[\leadsto \left(\color{blue}{\left(\frac{-1}{90} \cdot \left(a \cdot a\right)\right)} \cdot angle\right) \cdot \mathsf{PI}\left(\right) \]
      7. associate-*l*N/A

        \[\leadsto \color{blue}{\left(\frac{-1}{90} \cdot \left(\left(a \cdot a\right) \cdot angle\right)\right)} \cdot \mathsf{PI}\left(\right) \]
      8. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{-1}{90} \cdot \left(\left(a \cdot a\right) \cdot angle\right)\right)} \cdot \mathsf{PI}\left(\right) \]
      9. lower-*.f6461.0

        \[\leadsto \left(-0.011111111111111112 \cdot \color{blue}{\left(\left(a \cdot a\right) \cdot angle\right)}\right) \cdot \pi \]
    10. Applied rewrites61.0%

      \[\leadsto \color{blue}{\left(-0.011111111111111112 \cdot \left(\left(a \cdot a\right) \cdot angle\right)\right) \cdot \pi} \]

    if 0.0 < (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))

    1. Initial program 45.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. Applied rewrites58.8%

      \[\leadsto \color{blue}{\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right)\right)} \]
    4. Taylor expanded in b around inf

      \[\leadsto \color{blue}{{b}^{2} \cdot \sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \]
    5. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {b}^{2}} \]
      2. lower-*.f64N/A

        \[\leadsto \color{blue}{\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {b}^{2}} \]
      3. lower-sin.f64N/A

        \[\leadsto \color{blue}{\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot {b}^{2} \]
      4. lower-*.f64N/A

        \[\leadsto \sin \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot {b}^{2} \]
      5. lower-*.f64N/A

        \[\leadsto \sin \left(\frac{1}{90} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot {b}^{2} \]
      6. lower-PI.f64N/A

        \[\leadsto \sin \left(\frac{1}{90} \cdot \left(angle \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \cdot {b}^{2} \]
      7. unpow2N/A

        \[\leadsto \sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\left(b \cdot b\right)} \]
      8. lower-*.f6452.6

        \[\leadsto \sin \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot \color{blue}{\left(b \cdot b\right)} \]
    6. Applied rewrites52.6%

      \[\leadsto \color{blue}{\sin \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(b \cdot b\right)} \]
    7. Taylor expanded in angle around 0

      \[\leadsto \color{blue}{\frac{1}{90} \cdot \left(angle \cdot \left({b}^{2} \cdot \mathsf{PI}\left(\right)\right)\right)} \]
    8. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{1}{90} \cdot \left(angle \cdot \left({b}^{2} \cdot \mathsf{PI}\left(\right)\right)\right)} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{1}{90} \cdot \color{blue}{\left(angle \cdot \left({b}^{2} \cdot \mathsf{PI}\left(\right)\right)\right)} \]
      3. *-commutativeN/A

        \[\leadsto \frac{1}{90} \cdot \left(angle \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot {b}^{2}\right)}\right) \]
      4. lower-*.f64N/A

        \[\leadsto \frac{1}{90} \cdot \left(angle \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot {b}^{2}\right)}\right) \]
      5. lower-PI.f64N/A

        \[\leadsto \frac{1}{90} \cdot \left(angle \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot {b}^{2}\right)\right) \]
      6. unpow2N/A

        \[\leadsto \frac{1}{90} \cdot \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(b \cdot b\right)}\right)\right) \]
      7. lower-*.f6449.3

        \[\leadsto 0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \color{blue}{\left(b \cdot b\right)}\right)\right) \]
    9. Applied rewrites49.3%

      \[\leadsto \color{blue}{0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \left(b \cdot b\right)\right)\right)} \]
    10. Step-by-step derivation
      1. lift-PI.f64N/A

        \[\leadsto \frac{1}{90} \cdot \left(angle \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \left(b \cdot b\right)\right)\right) \]
      2. lift-*.f64N/A

        \[\leadsto \frac{1}{90} \cdot \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(b \cdot b\right)}\right)\right) \]
      3. associate-*r*N/A

        \[\leadsto \frac{1}{90} \cdot \color{blue}{\left(\left(angle \cdot \mathsf{PI}\left(\right)\right) \cdot \left(b \cdot b\right)\right)} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{1}{90} \cdot \left(\color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)} \cdot \left(b \cdot b\right)\right) \]
      5. lift-*.f64N/A

        \[\leadsto \frac{1}{90} \cdot \left(\left(angle \cdot \mathsf{PI}\left(\right)\right) \cdot \color{blue}{\left(b \cdot b\right)}\right) \]
      6. associate-*r*N/A

        \[\leadsto \frac{1}{90} \cdot \color{blue}{\left(\left(\left(angle \cdot \mathsf{PI}\left(\right)\right) \cdot b\right) \cdot b\right)} \]
      7. lower-*.f64N/A

        \[\leadsto \frac{1}{90} \cdot \color{blue}{\left(\left(\left(angle \cdot \mathsf{PI}\left(\right)\right) \cdot b\right) \cdot b\right)} \]
      8. lower-*.f6456.6

        \[\leadsto 0.011111111111111112 \cdot \left(\color{blue}{\left(\left(angle \cdot \pi\right) \cdot b\right)} \cdot b\right) \]
      9. lift-*.f64N/A

        \[\leadsto \frac{1}{90} \cdot \left(\left(\color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)} \cdot b\right) \cdot b\right) \]
      10. *-commutativeN/A

        \[\leadsto \frac{1}{90} \cdot \left(\left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot angle\right)} \cdot b\right) \cdot b\right) \]
      11. lift-*.f6456.6

        \[\leadsto 0.011111111111111112 \cdot \left(\left(\color{blue}{\left(\pi \cdot angle\right)} \cdot b\right) \cdot b\right) \]
    11. Applied rewrites56.6%

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

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

Alternative 8: 56.4% accurate, 2.0× speedup?

\[\begin{array}{l} a_m = \left|a\right| \\ \begin{array}{l} \mathbf{if}\;{b}^{2} - {a\_m}^{2} \leq 0:\\ \;\;\;\;\left(\pi \cdot angle\right) \cdot \left(\left(a\_m \cdot a\_m\right) \cdot -0.011111111111111112\right)\\ \mathbf{else}:\\ \;\;\;\;0.011111111111111112 \cdot \left(b \cdot \left(b \cdot \left(\pi \cdot angle\right)\right)\right)\\ \end{array} \end{array} \]
a_m = (fabs.f64 a)
(FPCore (a_m b angle)
 :precision binary64
 (if (<= (- (pow b 2.0) (pow a_m 2.0)) 0.0)
   (* (* PI angle) (* (* a_m a_m) -0.011111111111111112))
   (* 0.011111111111111112 (* b (* b (* PI angle))))))
a_m = fabs(a);
double code(double a_m, double b, double angle) {
	double tmp;
	if ((pow(b, 2.0) - pow(a_m, 2.0)) <= 0.0) {
		tmp = (((double) M_PI) * angle) * ((a_m * a_m) * -0.011111111111111112);
	} else {
		tmp = 0.011111111111111112 * (b * (b * (((double) M_PI) * angle)));
	}
	return tmp;
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle) {
	double tmp;
	if ((Math.pow(b, 2.0) - Math.pow(a_m, 2.0)) <= 0.0) {
		tmp = (Math.PI * angle) * ((a_m * a_m) * -0.011111111111111112);
	} else {
		tmp = 0.011111111111111112 * (b * (b * (Math.PI * angle)));
	}
	return tmp;
}
a_m = math.fabs(a)
def code(a_m, b, angle):
	tmp = 0
	if (math.pow(b, 2.0) - math.pow(a_m, 2.0)) <= 0.0:
		tmp = (math.pi * angle) * ((a_m * a_m) * -0.011111111111111112)
	else:
		tmp = 0.011111111111111112 * (b * (b * (math.pi * angle)))
	return tmp
a_m = abs(a)
function code(a_m, b, angle)
	tmp = 0.0
	if (Float64((b ^ 2.0) - (a_m ^ 2.0)) <= 0.0)
		tmp = Float64(Float64(pi * angle) * Float64(Float64(a_m * a_m) * -0.011111111111111112));
	else
		tmp = Float64(0.011111111111111112 * Float64(b * Float64(b * Float64(pi * angle))));
	end
	return tmp
end
a_m = abs(a);
function tmp_2 = code(a_m, b, angle)
	tmp = 0.0;
	if (((b ^ 2.0) - (a_m ^ 2.0)) <= 0.0)
		tmp = (pi * angle) * ((a_m * a_m) * -0.011111111111111112);
	else
		tmp = 0.011111111111111112 * (b * (b * (pi * angle)));
	end
	tmp_2 = tmp;
end
a_m = N[Abs[a], $MachinePrecision]
code[a$95$m_, b_, angle_] := If[LessEqual[N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a$95$m, 2.0], $MachinePrecision]), $MachinePrecision], 0.0], N[(N[(Pi * angle), $MachinePrecision] * N[(N[(a$95$m * a$95$m), $MachinePrecision] * -0.011111111111111112), $MachinePrecision]), $MachinePrecision], N[(0.011111111111111112 * N[(b * N[(b * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|

\\
\begin{array}{l}
\mathbf{if}\;{b}^{2} - {a\_m}^{2} \leq 0:\\
\;\;\;\;\left(\pi \cdot angle\right) \cdot \left(\left(a\_m \cdot a\_m\right) \cdot -0.011111111111111112\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64))) < 0.0

    1. Initial program 59.2%

      \[\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in angle around 0

      \[\leadsto \color{blue}{\frac{1}{90} \cdot \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \frac{1}{90} \cdot \color{blue}{\left(\left(angle \cdot \mathsf{PI}\left(\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)} \]
      2. associate-*r*N/A

        \[\leadsto \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot \left({b}^{2} - {a}^{2}\right) \]
      5. lower-*.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot \left({b}^{2} - {a}^{2}\right) \]
      6. lower-PI.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \cdot \left({b}^{2} - {a}^{2}\right) \]
      7. unpow2N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\color{blue}{b \cdot b} - {a}^{2}\right) \]
      8. unpow2N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(b \cdot b - \color{blue}{a \cdot a}\right) \]
      9. difference-of-squaresN/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \]
      10. lower-*.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \]
      11. lower-+.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\color{blue}{\left(b + a\right)} \cdot \left(b - a\right)\right) \]
      12. lower--.f6461.0

        \[\leadsto \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(\left(b + a\right) \cdot \color{blue}{\left(b - a\right)}\right) \]
    5. Applied rewrites61.0%

      \[\leadsto \color{blue}{\left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)} \]
    6. Taylor expanded in b around 0

      \[\leadsto \color{blue}{\frac{-1}{90} \cdot \left({a}^{2} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \]
    7. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \color{blue}{\left(\frac{-1}{90} \cdot {a}^{2}\right) \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)} \]
      2. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{-1}{90} \cdot {a}^{2}\right) \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{-1}{90} \cdot {a}^{2}\right)} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right) \]
      4. unpow2N/A

        \[\leadsto \left(\frac{-1}{90} \cdot \color{blue}{\left(a \cdot a\right)}\right) \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right) \]
      5. lower-*.f64N/A

        \[\leadsto \left(\frac{-1}{90} \cdot \color{blue}{\left(a \cdot a\right)}\right) \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right) \]
      6. lower-*.f64N/A

        \[\leadsto \left(\frac{-1}{90} \cdot \left(a \cdot a\right)\right) \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)} \]
      7. lower-PI.f6460.9

        \[\leadsto \left(-0.011111111111111112 \cdot \left(a \cdot a\right)\right) \cdot \left(angle \cdot \color{blue}{\pi}\right) \]
    8. Applied rewrites60.9%

      \[\leadsto \color{blue}{\left(-0.011111111111111112 \cdot \left(a \cdot a\right)\right) \cdot \left(angle \cdot \pi\right)} \]

    if 0.0 < (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))

    1. Initial program 45.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. Applied rewrites58.8%

      \[\leadsto \color{blue}{\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right)\right)} \]
    4. Taylor expanded in b around inf

      \[\leadsto \color{blue}{{b}^{2} \cdot \sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \]
    5. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {b}^{2}} \]
      2. lower-*.f64N/A

        \[\leadsto \color{blue}{\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {b}^{2}} \]
      3. lower-sin.f64N/A

        \[\leadsto \color{blue}{\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot {b}^{2} \]
      4. lower-*.f64N/A

        \[\leadsto \sin \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot {b}^{2} \]
      5. lower-*.f64N/A

        \[\leadsto \sin \left(\frac{1}{90} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot {b}^{2} \]
      6. lower-PI.f64N/A

        \[\leadsto \sin \left(\frac{1}{90} \cdot \left(angle \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \cdot {b}^{2} \]
      7. unpow2N/A

        \[\leadsto \sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\left(b \cdot b\right)} \]
      8. lower-*.f6452.6

        \[\leadsto \sin \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot \color{blue}{\left(b \cdot b\right)} \]
    6. Applied rewrites52.6%

      \[\leadsto \color{blue}{\sin \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(b \cdot b\right)} \]
    7. Taylor expanded in angle around 0

      \[\leadsto \color{blue}{\frac{1}{90} \cdot \left(angle \cdot \left({b}^{2} \cdot \mathsf{PI}\left(\right)\right)\right)} \]
    8. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{1}{90} \cdot \left(angle \cdot \left({b}^{2} \cdot \mathsf{PI}\left(\right)\right)\right)} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{1}{90} \cdot \color{blue}{\left(angle \cdot \left({b}^{2} \cdot \mathsf{PI}\left(\right)\right)\right)} \]
      3. *-commutativeN/A

        \[\leadsto \frac{1}{90} \cdot \left(angle \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot {b}^{2}\right)}\right) \]
      4. lower-*.f64N/A

        \[\leadsto \frac{1}{90} \cdot \left(angle \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot {b}^{2}\right)}\right) \]
      5. lower-PI.f64N/A

        \[\leadsto \frac{1}{90} \cdot \left(angle \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot {b}^{2}\right)\right) \]
      6. unpow2N/A

        \[\leadsto \frac{1}{90} \cdot \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(b \cdot b\right)}\right)\right) \]
      7. lower-*.f6449.3

        \[\leadsto 0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \color{blue}{\left(b \cdot b\right)}\right)\right) \]
    9. Applied rewrites49.3%

      \[\leadsto \color{blue}{0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \left(b \cdot b\right)\right)\right)} \]
    10. Step-by-step derivation
      1. lift-PI.f64N/A

        \[\leadsto \frac{1}{90} \cdot \left(angle \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \left(b \cdot b\right)\right)\right) \]
      2. lift-*.f64N/A

        \[\leadsto \frac{1}{90} \cdot \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(b \cdot b\right)}\right)\right) \]
      3. associate-*r*N/A

        \[\leadsto \frac{1}{90} \cdot \color{blue}{\left(\left(angle \cdot \mathsf{PI}\left(\right)\right) \cdot \left(b \cdot b\right)\right)} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{1}{90} \cdot \left(\color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)} \cdot \left(b \cdot b\right)\right) \]
      5. lift-*.f64N/A

        \[\leadsto \frac{1}{90} \cdot \left(\left(angle \cdot \mathsf{PI}\left(\right)\right) \cdot \color{blue}{\left(b \cdot b\right)}\right) \]
      6. associate-*r*N/A

        \[\leadsto \frac{1}{90} \cdot \color{blue}{\left(\left(\left(angle \cdot \mathsf{PI}\left(\right)\right) \cdot b\right) \cdot b\right)} \]
      7. lower-*.f64N/A

        \[\leadsto \frac{1}{90} \cdot \color{blue}{\left(\left(\left(angle \cdot \mathsf{PI}\left(\right)\right) \cdot b\right) \cdot b\right)} \]
      8. lower-*.f6456.6

        \[\leadsto 0.011111111111111112 \cdot \left(\color{blue}{\left(\left(angle \cdot \pi\right) \cdot b\right)} \cdot b\right) \]
      9. lift-*.f64N/A

        \[\leadsto \frac{1}{90} \cdot \left(\left(\color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)} \cdot b\right) \cdot b\right) \]
      10. *-commutativeN/A

        \[\leadsto \frac{1}{90} \cdot \left(\left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot angle\right)} \cdot b\right) \cdot b\right) \]
      11. lift-*.f6456.6

        \[\leadsto 0.011111111111111112 \cdot \left(\left(\color{blue}{\left(\pi \cdot angle\right)} \cdot b\right) \cdot b\right) \]
    11. Applied rewrites56.6%

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

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

Alternative 9: 63.0% accurate, 6.5× speedup?

\[\begin{array}{l} a_m = \left|a\right| \\ \begin{array}{l} \mathbf{if}\;\frac{angle}{180} \leq 500000:\\ \;\;\;\;\left(a\_m + b\right) \cdot \left(\left(b - a\_m\right) \cdot \left(angle \cdot \mathsf{fma}\left(-2.2862368541380886 \cdot 10^{-7} \cdot \left(angle \cdot angle\right), \pi \cdot \left(\pi \cdot \pi\right), 0.011111111111111112 \cdot \pi\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\pi \cdot \left(0.011111111111111112 \cdot angle\right)\right) \cdot \left(\left(a\_m + b\right) \cdot \left(b - a\_m\right)\right)\\ \end{array} \end{array} \]
a_m = (fabs.f64 a)
(FPCore (a_m b angle)
 :precision binary64
 (if (<= (/ angle 180.0) 500000.0)
   (*
    (+ a_m b)
    (*
     (- b a_m)
     (*
      angle
      (fma
       (* -2.2862368541380886e-7 (* angle angle))
       (* PI (* PI PI))
       (* 0.011111111111111112 PI)))))
   (* (* PI (* 0.011111111111111112 angle)) (* (+ a_m b) (- b a_m)))))
a_m = fabs(a);
double code(double a_m, double b, double angle) {
	double tmp;
	if ((angle / 180.0) <= 500000.0) {
		tmp = (a_m + b) * ((b - a_m) * (angle * fma((-2.2862368541380886e-7 * (angle * angle)), (((double) M_PI) * (((double) M_PI) * ((double) M_PI))), (0.011111111111111112 * ((double) M_PI)))));
	} else {
		tmp = (((double) M_PI) * (0.011111111111111112 * angle)) * ((a_m + b) * (b - a_m));
	}
	return tmp;
}
a_m = abs(a)
function code(a_m, b, angle)
	tmp = 0.0
	if (Float64(angle / 180.0) <= 500000.0)
		tmp = Float64(Float64(a_m + b) * Float64(Float64(b - a_m) * Float64(angle * fma(Float64(-2.2862368541380886e-7 * Float64(angle * angle)), Float64(pi * Float64(pi * pi)), Float64(0.011111111111111112 * pi)))));
	else
		tmp = Float64(Float64(pi * Float64(0.011111111111111112 * angle)) * Float64(Float64(a_m + b) * Float64(b - a_m)));
	end
	return tmp
end
a_m = N[Abs[a], $MachinePrecision]
code[a$95$m_, b_, angle_] := If[LessEqual[N[(angle / 180.0), $MachinePrecision], 500000.0], N[(N[(a$95$m + b), $MachinePrecision] * N[(N[(b - a$95$m), $MachinePrecision] * N[(angle * N[(N[(-2.2862368541380886e-7 * N[(angle * angle), $MachinePrecision]), $MachinePrecision] * N[(Pi * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision] + N[(0.011111111111111112 * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * N[(0.011111111111111112 * angle), $MachinePrecision]), $MachinePrecision] * N[(N[(a$95$m + b), $MachinePrecision] * N[(b - a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|

\\
\begin{array}{l}
\mathbf{if}\;\frac{angle}{180} \leq 500000:\\
\;\;\;\;\left(a\_m + b\right) \cdot \left(\left(b - a\_m\right) \cdot \left(angle \cdot \mathsf{fma}\left(-2.2862368541380886 \cdot 10^{-7} \cdot \left(angle \cdot angle\right), \pi \cdot \left(\pi \cdot \pi\right), 0.011111111111111112 \cdot \pi\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 angle #s(literal 180 binary64)) < 5e5

    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. Applied rewrites72.0%

      \[\leadsto \color{blue}{\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right)\right)} \]
    4. Taylor expanded in angle around 0

      \[\leadsto \left(b + a\right) \cdot \left(\left(b - a\right) \cdot \color{blue}{\left(angle \cdot \left(\frac{-1}{4374000} \cdot \left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + \frac{1}{90} \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
    5. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\left(b - a\right) \cdot \color{blue}{\left(angle \cdot \left(\frac{-1}{4374000} \cdot \left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) + \frac{1}{90} \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
      2. associate-*r*N/A

        \[\leadsto \left(b + a\right) \cdot \left(\left(b - a\right) \cdot \left(angle \cdot \left(\color{blue}{\left(\frac{-1}{4374000} \cdot {angle}^{2}\right) \cdot {\mathsf{PI}\left(\right)}^{3}} + \frac{1}{90} \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      3. lower-fma.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\left(b - a\right) \cdot \left(angle \cdot \color{blue}{\mathsf{fma}\left(\frac{-1}{4374000} \cdot {angle}^{2}, {\mathsf{PI}\left(\right)}^{3}, \frac{1}{90} \cdot \mathsf{PI}\left(\right)\right)}\right)\right) \]
      4. lower-*.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\left(b - a\right) \cdot \left(angle \cdot \mathsf{fma}\left(\color{blue}{\frac{-1}{4374000} \cdot {angle}^{2}}, {\mathsf{PI}\left(\right)}^{3}, \frac{1}{90} \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      5. unpow2N/A

        \[\leadsto \left(b + a\right) \cdot \left(\left(b - a\right) \cdot \left(angle \cdot \mathsf{fma}\left(\frac{-1}{4374000} \cdot \color{blue}{\left(angle \cdot angle\right)}, {\mathsf{PI}\left(\right)}^{3}, \frac{1}{90} \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      6. lower-*.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\left(b - a\right) \cdot \left(angle \cdot \mathsf{fma}\left(\frac{-1}{4374000} \cdot \color{blue}{\left(angle \cdot angle\right)}, {\mathsf{PI}\left(\right)}^{3}, \frac{1}{90} \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      7. cube-multN/A

        \[\leadsto \left(b + a\right) \cdot \left(\left(b - a\right) \cdot \left(angle \cdot \mathsf{fma}\left(\frac{-1}{4374000} \cdot \left(angle \cdot angle\right), \color{blue}{\mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, \frac{1}{90} \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      8. unpow2N/A

        \[\leadsto \left(b + a\right) \cdot \left(\left(b - a\right) \cdot \left(angle \cdot \mathsf{fma}\left(\frac{-1}{4374000} \cdot \left(angle \cdot angle\right), \mathsf{PI}\left(\right) \cdot \color{blue}{{\mathsf{PI}\left(\right)}^{2}}, \frac{1}{90} \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      9. lower-*.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\left(b - a\right) \cdot \left(angle \cdot \mathsf{fma}\left(\frac{-1}{4374000} \cdot \left(angle \cdot angle\right), \color{blue}{\mathsf{PI}\left(\right) \cdot {\mathsf{PI}\left(\right)}^{2}}, \frac{1}{90} \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      10. lower-PI.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\left(b - a\right) \cdot \left(angle \cdot \mathsf{fma}\left(\frac{-1}{4374000} \cdot \left(angle \cdot angle\right), \color{blue}{\mathsf{PI}\left(\right)} \cdot {\mathsf{PI}\left(\right)}^{2}, \frac{1}{90} \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      11. unpow2N/A

        \[\leadsto \left(b + a\right) \cdot \left(\left(b - a\right) \cdot \left(angle \cdot \mathsf{fma}\left(\frac{-1}{4374000} \cdot \left(angle \cdot angle\right), \mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, \frac{1}{90} \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      12. lower-*.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\left(b - a\right) \cdot \left(angle \cdot \mathsf{fma}\left(\frac{-1}{4374000} \cdot \left(angle \cdot angle\right), \mathsf{PI}\left(\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}, \frac{1}{90} \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      13. lower-PI.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\left(b - a\right) \cdot \left(angle \cdot \mathsf{fma}\left(\frac{-1}{4374000} \cdot \left(angle \cdot angle\right), \mathsf{PI}\left(\right) \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right), \frac{1}{90} \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      14. lower-PI.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\left(b - a\right) \cdot \left(angle \cdot \mathsf{fma}\left(\frac{-1}{4374000} \cdot \left(angle \cdot angle\right), \mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}\right), \frac{1}{90} \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
      15. lower-*.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\left(b - a\right) \cdot \left(angle \cdot \mathsf{fma}\left(\frac{-1}{4374000} \cdot \left(angle \cdot angle\right), \mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), \color{blue}{\frac{1}{90} \cdot \mathsf{PI}\left(\right)}\right)\right)\right) \]
      16. lower-PI.f6467.0

        \[\leadsto \left(b + a\right) \cdot \left(\left(b - a\right) \cdot \left(angle \cdot \mathsf{fma}\left(-2.2862368541380886 \cdot 10^{-7} \cdot \left(angle \cdot angle\right), \pi \cdot \left(\pi \cdot \pi\right), 0.011111111111111112 \cdot \color{blue}{\pi}\right)\right)\right) \]
    6. Applied rewrites67.0%

      \[\leadsto \left(b + a\right) \cdot \left(\left(b - a\right) \cdot \color{blue}{\left(angle \cdot \mathsf{fma}\left(-2.2862368541380886 \cdot 10^{-7} \cdot \left(angle \cdot angle\right), \pi \cdot \left(\pi \cdot \pi\right), 0.011111111111111112 \cdot \pi\right)\right)}\right) \]

    if 5e5 < (/.f64 angle #s(literal 180 binary64))

    1. Initial program 35.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. Taylor expanded in angle around 0

      \[\leadsto \color{blue}{\frac{1}{90} \cdot \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \frac{1}{90} \cdot \color{blue}{\left(\left(angle \cdot \mathsf{PI}\left(\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)} \]
      2. associate-*r*N/A

        \[\leadsto \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot \left({b}^{2} - {a}^{2}\right) \]
      5. lower-*.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot \left({b}^{2} - {a}^{2}\right) \]
      6. lower-PI.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \cdot \left({b}^{2} - {a}^{2}\right) \]
      7. unpow2N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\color{blue}{b \cdot b} - {a}^{2}\right) \]
      8. unpow2N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(b \cdot b - \color{blue}{a \cdot a}\right) \]
      9. difference-of-squaresN/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \]
      10. lower-*.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \]
      11. lower-+.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\color{blue}{\left(b + a\right)} \cdot \left(b - a\right)\right) \]
      12. lower--.f6442.2

        \[\leadsto \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(\left(b + a\right) \cdot \color{blue}{\left(b - a\right)}\right) \]
    5. Applied rewrites42.2%

      \[\leadsto \color{blue}{\left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)} \]
    6. Step-by-step derivation
      1. lift-PI.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right) \]
      2. lift-*.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right) \]
      3. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right) \]
      4. difference-of-squaresN/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\left(b \cdot b - a \cdot a\right)} \]
      5. pow2N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\color{blue}{{b}^{2}} - a \cdot a\right) \]
      6. lift-pow.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\color{blue}{{b}^{2}} - a \cdot a\right) \]
      7. pow2N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - \color{blue}{{a}^{2}}\right) \]
      8. lift-pow.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - \color{blue}{{a}^{2}}\right) \]
      9. lift--.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\left({b}^{2} - {a}^{2}\right)} \]
      10. *-commutativeN/A

        \[\leadsto \color{blue}{\left({b}^{2} - {a}^{2}\right) \cdot \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \]
      11. lower-*.f6435.1

        \[\leadsto \color{blue}{\left({b}^{2} - {a}^{2}\right) \cdot \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right)} \]
      12. lift--.f64N/A

        \[\leadsto \color{blue}{\left({b}^{2} - {a}^{2}\right)} \cdot \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \]
      13. lift-pow.f64N/A

        \[\leadsto \left(\color{blue}{{b}^{2}} - {a}^{2}\right) \cdot \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \]
      14. pow2N/A

        \[\leadsto \left(\color{blue}{b \cdot b} - {a}^{2}\right) \cdot \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \]
      15. lift-pow.f64N/A

        \[\leadsto \left(b \cdot b - \color{blue}{{a}^{2}}\right) \cdot \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \]
      16. pow2N/A

        \[\leadsto \left(b \cdot b - \color{blue}{a \cdot a}\right) \cdot \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \]
      17. difference-of-squaresN/A

        \[\leadsto \color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \cdot \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \]
      18. lift-+.f64N/A

        \[\leadsto \left(\color{blue}{\left(b + a\right)} \cdot \left(b - a\right)\right) \cdot \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \]
      19. lift--.f64N/A

        \[\leadsto \left(\left(b + a\right) \cdot \color{blue}{\left(b - a\right)}\right) \cdot \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \]
      20. lift-*.f6442.2

        \[\leadsto \color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \cdot \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \]
      21. lift-*.f64N/A

        \[\leadsto \left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \]
      22. lift-*.f64N/A

        \[\leadsto \left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\frac{1}{90} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right) \]
      23. associate-*r*N/A

        \[\leadsto \left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \color{blue}{\left(\left(\frac{1}{90} \cdot angle\right) \cdot \mathsf{PI}\left(\right)\right)} \]
      24. *-commutativeN/A

        \[\leadsto \left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \left(\frac{1}{90} \cdot angle\right)\right)} \]
      25. lower-*.f64N/A

        \[\leadsto \left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \left(\frac{1}{90} \cdot angle\right)\right)} \]
      26. *-commutativeN/A

        \[\leadsto \left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(angle \cdot \frac{1}{90}\right)}\right) \]
      27. lower-*.f6442.2

        \[\leadsto \left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\pi \cdot \color{blue}{\left(angle \cdot 0.011111111111111112\right)}\right) \]
    7. Applied rewrites42.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{angle}{180} \leq 500000:\\ \;\;\;\;\left(a + b\right) \cdot \left(\left(b - a\right) \cdot \left(angle \cdot \mathsf{fma}\left(-2.2862368541380886 \cdot 10^{-7} \cdot \left(angle \cdot angle\right), \pi \cdot \left(\pi \cdot \pi\right), 0.011111111111111112 \cdot \pi\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\pi \cdot \left(0.011111111111111112 \cdot angle\right)\right) \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 62.0% accurate, 6.6× speedup?

\[\begin{array}{l} a_m = \left|a\right| \\ \begin{array}{l} \mathbf{if}\;\frac{angle}{180} \leq 2 \cdot 10^{-14}:\\ \;\;\;\;\left(a\_m + b\right) \cdot \left(\left(0.011111111111111112 \cdot angle\right) \cdot \left(\left(b - a\_m\right) \cdot \pi\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(a\_m + b\right) \cdot \left(b - a\_m\right)\right) \cdot \left(\sqrt{\pi} \cdot \left(\left(0.011111111111111112 \cdot angle\right) \cdot \sqrt{\pi}\right)\right)\\ \end{array} \end{array} \]
a_m = (fabs.f64 a)
(FPCore (a_m b angle)
 :precision binary64
 (if (<= (/ angle 180.0) 2e-14)
   (* (+ a_m b) (* (* 0.011111111111111112 angle) (* (- b a_m) PI)))
   (*
    (* (+ a_m b) (- b a_m))
    (* (sqrt PI) (* (* 0.011111111111111112 angle) (sqrt PI))))))
a_m = fabs(a);
double code(double a_m, double b, double angle) {
	double tmp;
	if ((angle / 180.0) <= 2e-14) {
		tmp = (a_m + b) * ((0.011111111111111112 * angle) * ((b - a_m) * ((double) M_PI)));
	} else {
		tmp = ((a_m + b) * (b - a_m)) * (sqrt(((double) M_PI)) * ((0.011111111111111112 * angle) * sqrt(((double) M_PI))));
	}
	return tmp;
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle) {
	double tmp;
	if ((angle / 180.0) <= 2e-14) {
		tmp = (a_m + b) * ((0.011111111111111112 * angle) * ((b - a_m) * Math.PI));
	} else {
		tmp = ((a_m + b) * (b - a_m)) * (Math.sqrt(Math.PI) * ((0.011111111111111112 * angle) * Math.sqrt(Math.PI)));
	}
	return tmp;
}
a_m = math.fabs(a)
def code(a_m, b, angle):
	tmp = 0
	if (angle / 180.0) <= 2e-14:
		tmp = (a_m + b) * ((0.011111111111111112 * angle) * ((b - a_m) * math.pi))
	else:
		tmp = ((a_m + b) * (b - a_m)) * (math.sqrt(math.pi) * ((0.011111111111111112 * angle) * math.sqrt(math.pi)))
	return tmp
a_m = abs(a)
function code(a_m, b, angle)
	tmp = 0.0
	if (Float64(angle / 180.0) <= 2e-14)
		tmp = Float64(Float64(a_m + b) * Float64(Float64(0.011111111111111112 * angle) * Float64(Float64(b - a_m) * pi)));
	else
		tmp = Float64(Float64(Float64(a_m + b) * Float64(b - a_m)) * Float64(sqrt(pi) * Float64(Float64(0.011111111111111112 * angle) * sqrt(pi))));
	end
	return tmp
end
a_m = abs(a);
function tmp_2 = code(a_m, b, angle)
	tmp = 0.0;
	if ((angle / 180.0) <= 2e-14)
		tmp = (a_m + b) * ((0.011111111111111112 * angle) * ((b - a_m) * pi));
	else
		tmp = ((a_m + b) * (b - a_m)) * (sqrt(pi) * ((0.011111111111111112 * angle) * sqrt(pi)));
	end
	tmp_2 = tmp;
end
a_m = N[Abs[a], $MachinePrecision]
code[a$95$m_, b_, angle_] := If[LessEqual[N[(angle / 180.0), $MachinePrecision], 2e-14], N[(N[(a$95$m + b), $MachinePrecision] * N[(N[(0.011111111111111112 * angle), $MachinePrecision] * N[(N[(b - a$95$m), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a$95$m + b), $MachinePrecision] * N[(b - a$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[Pi], $MachinePrecision] * N[(N[(0.011111111111111112 * angle), $MachinePrecision] * N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 angle #s(literal 180 binary64)) < 2e-14

    1. Initial program 58.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. Applied rewrites71.5%

      \[\leadsto \color{blue}{\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right)\right)} \]
    4. Taylor expanded in angle around 0

      \[\leadsto \left(b + a\right) \cdot \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot \left(b - a\right)\right)\right)\right)} \]
    5. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(b + a\right) \cdot \color{blue}{\left(\left(\frac{1}{90} \cdot angle\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(b - a\right)\right)\right)} \]
      2. lower-*.f64N/A

        \[\leadsto \left(b + a\right) \cdot \color{blue}{\left(\left(\frac{1}{90} \cdot angle\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(b - a\right)\right)\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\color{blue}{\left(\frac{1}{90} \cdot angle\right)} \cdot \left(\mathsf{PI}\left(\right) \cdot \left(b - a\right)\right)\right) \]
      4. lower-*.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\left(\frac{1}{90} \cdot angle\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \left(b - a\right)\right)}\right) \]
      5. lower-PI.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\left(\frac{1}{90} \cdot angle\right) \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \left(b - a\right)\right)\right) \]
      6. lower--.f6471.0

        \[\leadsto \left(b + a\right) \cdot \left(\left(0.011111111111111112 \cdot angle\right) \cdot \left(\pi \cdot \color{blue}{\left(b - a\right)}\right)\right) \]
    6. Applied rewrites71.0%

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

    if 2e-14 < (/.f64 angle #s(literal 180 binary64))

    1. Initial program 38.2%

      \[\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in angle around 0

      \[\leadsto \color{blue}{\frac{1}{90} \cdot \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \frac{1}{90} \cdot \color{blue}{\left(\left(angle \cdot \mathsf{PI}\left(\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)} \]
      2. associate-*r*N/A

        \[\leadsto \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot \left({b}^{2} - {a}^{2}\right) \]
      5. lower-*.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot \left({b}^{2} - {a}^{2}\right) \]
      6. lower-PI.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \cdot \left({b}^{2} - {a}^{2}\right) \]
      7. unpow2N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\color{blue}{b \cdot b} - {a}^{2}\right) \]
      8. unpow2N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(b \cdot b - \color{blue}{a \cdot a}\right) \]
      9. difference-of-squaresN/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \]
      10. lower-*.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \]
      11. lower-+.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\color{blue}{\left(b + a\right)} \cdot \left(b - a\right)\right) \]
      12. lower--.f6443.6

        \[\leadsto \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(\left(b + a\right) \cdot \color{blue}{\left(b - a\right)}\right) \]
    5. Applied rewrites43.6%

      \[\leadsto \color{blue}{\left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)} \]
    6. Step-by-step derivation
      1. lift-PI.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right) \]
      2. associate-*r*N/A

        \[\leadsto \color{blue}{\left(\left(\frac{1}{90} \cdot angle\right) \cdot \mathsf{PI}\left(\right)\right)} \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right) \]
      3. lift-PI.f64N/A

        \[\leadsto \left(\left(\frac{1}{90} \cdot angle\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}\right) \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right) \]
      4. add-sqr-sqrtN/A

        \[\leadsto \left(\left(\frac{1}{90} \cdot angle\right) \cdot \color{blue}{\left(\sqrt{\mathsf{PI}\left(\right)} \cdot \sqrt{\mathsf{PI}\left(\right)}\right)}\right) \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right) \]
      5. associate-*r*N/A

        \[\leadsto \color{blue}{\left(\left(\left(\frac{1}{90} \cdot angle\right) \cdot \sqrt{\mathsf{PI}\left(\right)}\right) \cdot \sqrt{\mathsf{PI}\left(\right)}\right)} \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right) \]
      6. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\left(\left(\frac{1}{90} \cdot angle\right) \cdot \sqrt{\mathsf{PI}\left(\right)}\right) \cdot \sqrt{\mathsf{PI}\left(\right)}\right)} \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right) \]
      7. lower-*.f64N/A

        \[\leadsto \left(\color{blue}{\left(\left(\frac{1}{90} \cdot angle\right) \cdot \sqrt{\mathsf{PI}\left(\right)}\right)} \cdot \sqrt{\mathsf{PI}\left(\right)}\right) \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \left(\left(\color{blue}{\left(angle \cdot \frac{1}{90}\right)} \cdot \sqrt{\mathsf{PI}\left(\right)}\right) \cdot \sqrt{\mathsf{PI}\left(\right)}\right) \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right) \]
      9. lower-*.f64N/A

        \[\leadsto \left(\left(\color{blue}{\left(angle \cdot \frac{1}{90}\right)} \cdot \sqrt{\mathsf{PI}\left(\right)}\right) \cdot \sqrt{\mathsf{PI}\left(\right)}\right) \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right) \]
      10. lift-PI.f64N/A

        \[\leadsto \left(\left(\left(angle \cdot \frac{1}{90}\right) \cdot \sqrt{\color{blue}{\mathsf{PI}\left(\right)}}\right) \cdot \sqrt{\mathsf{PI}\left(\right)}\right) \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right) \]
      11. lower-sqrt.f64N/A

        \[\leadsto \left(\left(\left(angle \cdot \frac{1}{90}\right) \cdot \color{blue}{\sqrt{\mathsf{PI}\left(\right)}}\right) \cdot \sqrt{\mathsf{PI}\left(\right)}\right) \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right) \]
      12. lift-PI.f64N/A

        \[\leadsto \left(\left(\left(angle \cdot \frac{1}{90}\right) \cdot \sqrt{\mathsf{PI}\left(\right)}\right) \cdot \sqrt{\color{blue}{\mathsf{PI}\left(\right)}}\right) \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right) \]
      13. lower-sqrt.f6443.6

        \[\leadsto \left(\left(\left(angle \cdot 0.011111111111111112\right) \cdot \sqrt{\pi}\right) \cdot \color{blue}{\sqrt{\pi}}\right) \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right) \]
    7. Applied rewrites43.6%

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

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

Alternative 11: 61.7% accurate, 10.3× speedup?

\[\begin{array}{l} a_m = \left|a\right| \\ \begin{array}{l} \mathbf{if}\;\frac{angle}{180} \leq 2 \cdot 10^{-64}:\\ \;\;\;\;\left(a\_m + b\right) \cdot \left(\left(0.011111111111111112 \cdot angle\right) \cdot \left(\left(b - a\_m\right) \cdot \pi\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\pi \cdot \left(0.011111111111111112 \cdot angle\right)\right) \cdot \left(\left(a\_m + b\right) \cdot \left(b - a\_m\right)\right)\\ \end{array} \end{array} \]
a_m = (fabs.f64 a)
(FPCore (a_m b angle)
 :precision binary64
 (if (<= (/ angle 180.0) 2e-64)
   (* (+ a_m b) (* (* 0.011111111111111112 angle) (* (- b a_m) PI)))
   (* (* PI (* 0.011111111111111112 angle)) (* (+ a_m b) (- b a_m)))))
a_m = fabs(a);
double code(double a_m, double b, double angle) {
	double tmp;
	if ((angle / 180.0) <= 2e-64) {
		tmp = (a_m + b) * ((0.011111111111111112 * angle) * ((b - a_m) * ((double) M_PI)));
	} else {
		tmp = (((double) M_PI) * (0.011111111111111112 * angle)) * ((a_m + b) * (b - a_m));
	}
	return tmp;
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle) {
	double tmp;
	if ((angle / 180.0) <= 2e-64) {
		tmp = (a_m + b) * ((0.011111111111111112 * angle) * ((b - a_m) * Math.PI));
	} else {
		tmp = (Math.PI * (0.011111111111111112 * angle)) * ((a_m + b) * (b - a_m));
	}
	return tmp;
}
a_m = math.fabs(a)
def code(a_m, b, angle):
	tmp = 0
	if (angle / 180.0) <= 2e-64:
		tmp = (a_m + b) * ((0.011111111111111112 * angle) * ((b - a_m) * math.pi))
	else:
		tmp = (math.pi * (0.011111111111111112 * angle)) * ((a_m + b) * (b - a_m))
	return tmp
a_m = abs(a)
function code(a_m, b, angle)
	tmp = 0.0
	if (Float64(angle / 180.0) <= 2e-64)
		tmp = Float64(Float64(a_m + b) * Float64(Float64(0.011111111111111112 * angle) * Float64(Float64(b - a_m) * pi)));
	else
		tmp = Float64(Float64(pi * Float64(0.011111111111111112 * angle)) * Float64(Float64(a_m + b) * Float64(b - a_m)));
	end
	return tmp
end
a_m = abs(a);
function tmp_2 = code(a_m, b, angle)
	tmp = 0.0;
	if ((angle / 180.0) <= 2e-64)
		tmp = (a_m + b) * ((0.011111111111111112 * angle) * ((b - a_m) * pi));
	else
		tmp = (pi * (0.011111111111111112 * angle)) * ((a_m + b) * (b - a_m));
	end
	tmp_2 = tmp;
end
a_m = N[Abs[a], $MachinePrecision]
code[a$95$m_, b_, angle_] := If[LessEqual[N[(angle / 180.0), $MachinePrecision], 2e-64], N[(N[(a$95$m + b), $MachinePrecision] * N[(N[(0.011111111111111112 * angle), $MachinePrecision] * N[(N[(b - a$95$m), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * N[(0.011111111111111112 * angle), $MachinePrecision]), $MachinePrecision] * N[(N[(a$95$m + b), $MachinePrecision] * N[(b - a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 angle #s(literal 180 binary64)) < 1.99999999999999993e-64

    1. Initial program 55.3%

      \[\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. Applied rewrites69.3%

      \[\leadsto \color{blue}{\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right)\right)} \]
    4. Taylor expanded in angle around 0

      \[\leadsto \left(b + a\right) \cdot \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot \left(b - a\right)\right)\right)\right)} \]
    5. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(b + a\right) \cdot \color{blue}{\left(\left(\frac{1}{90} \cdot angle\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(b - a\right)\right)\right)} \]
      2. lower-*.f64N/A

        \[\leadsto \left(b + a\right) \cdot \color{blue}{\left(\left(\frac{1}{90} \cdot angle\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(b - a\right)\right)\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\color{blue}{\left(\frac{1}{90} \cdot angle\right)} \cdot \left(\mathsf{PI}\left(\right) \cdot \left(b - a\right)\right)\right) \]
      4. lower-*.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\left(\frac{1}{90} \cdot angle\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \left(b - a\right)\right)}\right) \]
      5. lower-PI.f64N/A

        \[\leadsto \left(b + a\right) \cdot \left(\left(\frac{1}{90} \cdot angle\right) \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \left(b - a\right)\right)\right) \]
      6. lower--.f6468.8

        \[\leadsto \left(b + a\right) \cdot \left(\left(0.011111111111111112 \cdot angle\right) \cdot \left(\pi \cdot \color{blue}{\left(b - a\right)}\right)\right) \]
    6. Applied rewrites68.8%

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

    if 1.99999999999999993e-64 < (/.f64 angle #s(literal 180 binary64))

    1. Initial program 46.3%

      \[\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. Taylor expanded in angle around 0

      \[\leadsto \color{blue}{\frac{1}{90} \cdot \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \frac{1}{90} \cdot \color{blue}{\left(\left(angle \cdot \mathsf{PI}\left(\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)} \]
      2. associate-*r*N/A

        \[\leadsto \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot \left({b}^{2} - {a}^{2}\right) \]
      5. lower-*.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot \left({b}^{2} - {a}^{2}\right) \]
      6. lower-PI.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \cdot \left({b}^{2} - {a}^{2}\right) \]
      7. unpow2N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\color{blue}{b \cdot b} - {a}^{2}\right) \]
      8. unpow2N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(b \cdot b - \color{blue}{a \cdot a}\right) \]
      9. difference-of-squaresN/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \]
      10. lower-*.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \]
      11. lower-+.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\color{blue}{\left(b + a\right)} \cdot \left(b - a\right)\right) \]
      12. lower--.f6452.0

        \[\leadsto \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(\left(b + a\right) \cdot \color{blue}{\left(b - a\right)}\right) \]
    5. Applied rewrites52.0%

      \[\leadsto \color{blue}{\left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)} \]
    6. Step-by-step derivation
      1. lift-PI.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right) \]
      2. lift-*.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right) \]
      3. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right) \]
      4. difference-of-squaresN/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\left(b \cdot b - a \cdot a\right)} \]
      5. pow2N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\color{blue}{{b}^{2}} - a \cdot a\right) \]
      6. lift-pow.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\color{blue}{{b}^{2}} - a \cdot a\right) \]
      7. pow2N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - \color{blue}{{a}^{2}}\right) \]
      8. lift-pow.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - \color{blue}{{a}^{2}}\right) \]
      9. lift--.f64N/A

        \[\leadsto \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\left({b}^{2} - {a}^{2}\right)} \]
      10. *-commutativeN/A

        \[\leadsto \color{blue}{\left({b}^{2} - {a}^{2}\right) \cdot \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \]
      11. lower-*.f6445.1

        \[\leadsto \color{blue}{\left({b}^{2} - {a}^{2}\right) \cdot \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right)} \]
      12. lift--.f64N/A

        \[\leadsto \color{blue}{\left({b}^{2} - {a}^{2}\right)} \cdot \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \]
      13. lift-pow.f64N/A

        \[\leadsto \left(\color{blue}{{b}^{2}} - {a}^{2}\right) \cdot \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \]
      14. pow2N/A

        \[\leadsto \left(\color{blue}{b \cdot b} - {a}^{2}\right) \cdot \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \]
      15. lift-pow.f64N/A

        \[\leadsto \left(b \cdot b - \color{blue}{{a}^{2}}\right) \cdot \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \]
      16. pow2N/A

        \[\leadsto \left(b \cdot b - \color{blue}{a \cdot a}\right) \cdot \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \]
      17. difference-of-squaresN/A

        \[\leadsto \color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \cdot \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \]
      18. lift-+.f64N/A

        \[\leadsto \left(\color{blue}{\left(b + a\right)} \cdot \left(b - a\right)\right) \cdot \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \]
      19. lift--.f64N/A

        \[\leadsto \left(\left(b + a\right) \cdot \color{blue}{\left(b - a\right)}\right) \cdot \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \]
      20. lift-*.f6452.0

        \[\leadsto \color{blue}{\left(\left(b + a\right) \cdot \left(b - a\right)\right)} \cdot \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \]
      21. lift-*.f64N/A

        \[\leadsto \left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \]
      22. lift-*.f64N/A

        \[\leadsto \left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\frac{1}{90} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right) \]
      23. associate-*r*N/A

        \[\leadsto \left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \color{blue}{\left(\left(\frac{1}{90} \cdot angle\right) \cdot \mathsf{PI}\left(\right)\right)} \]
      24. *-commutativeN/A

        \[\leadsto \left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \left(\frac{1}{90} \cdot angle\right)\right)} \]
      25. lower-*.f64N/A

        \[\leadsto \left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \left(\frac{1}{90} \cdot angle\right)\right)} \]
      26. *-commutativeN/A

        \[\leadsto \left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(angle \cdot \frac{1}{90}\right)}\right) \]
      27. lower-*.f6452.0

        \[\leadsto \left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\pi \cdot \color{blue}{\left(angle \cdot 0.011111111111111112\right)}\right) \]
    7. Applied rewrites52.0%

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

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

Alternative 12: 38.6% accurate, 21.6× speedup?

\[\begin{array}{l} a_m = \left|a\right| \\ 0.011111111111111112 \cdot \left(b \cdot \left(b \cdot \left(\pi \cdot angle\right)\right)\right) \end{array} \]
a_m = (fabs.f64 a)
(FPCore (a_m b angle)
 :precision binary64
 (* 0.011111111111111112 (* b (* b (* PI angle)))))
a_m = fabs(a);
double code(double a_m, double b, double angle) {
	return 0.011111111111111112 * (b * (b * (((double) M_PI) * angle)));
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle) {
	return 0.011111111111111112 * (b * (b * (Math.PI * angle)));
}
a_m = math.fabs(a)
def code(a_m, b, angle):
	return 0.011111111111111112 * (b * (b * (math.pi * angle)))
a_m = abs(a)
function code(a_m, b, angle)
	return Float64(0.011111111111111112 * Float64(b * Float64(b * Float64(pi * angle))))
end
a_m = abs(a);
function tmp = code(a_m, b, angle)
	tmp = 0.011111111111111112 * (b * (b * (pi * angle)));
end
a_m = N[Abs[a], $MachinePrecision]
code[a$95$m_, b_, angle_] := N[(0.011111111111111112 * N[(b * N[(b * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|

\\
0.011111111111111112 \cdot \left(b \cdot \left(b \cdot \left(\pi \cdot angle\right)\right)\right)
\end{array}
Derivation
  1. Initial program 52.3%

    \[\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. Applied rewrites63.3%

    \[\leadsto \color{blue}{\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right)\right)} \]
  4. Taylor expanded in b around inf

    \[\leadsto \color{blue}{{b}^{2} \cdot \sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \]
  5. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \color{blue}{\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {b}^{2}} \]
    2. lower-*.f64N/A

      \[\leadsto \color{blue}{\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {b}^{2}} \]
    3. lower-sin.f64N/A

      \[\leadsto \color{blue}{\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot {b}^{2} \]
    4. lower-*.f64N/A

      \[\leadsto \sin \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot {b}^{2} \]
    5. lower-*.f64N/A

      \[\leadsto \sin \left(\frac{1}{90} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot {b}^{2} \]
    6. lower-PI.f64N/A

      \[\leadsto \sin \left(\frac{1}{90} \cdot \left(angle \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \cdot {b}^{2} \]
    7. unpow2N/A

      \[\leadsto \sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\left(b \cdot b\right)} \]
    8. lower-*.f6436.7

      \[\leadsto \sin \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot \color{blue}{\left(b \cdot b\right)} \]
  6. Applied rewrites36.7%

    \[\leadsto \color{blue}{\sin \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(b \cdot b\right)} \]
  7. Taylor expanded in angle around 0

    \[\leadsto \color{blue}{\frac{1}{90} \cdot \left(angle \cdot \left({b}^{2} \cdot \mathsf{PI}\left(\right)\right)\right)} \]
  8. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto \color{blue}{\frac{1}{90} \cdot \left(angle \cdot \left({b}^{2} \cdot \mathsf{PI}\left(\right)\right)\right)} \]
    2. lower-*.f64N/A

      \[\leadsto \frac{1}{90} \cdot \color{blue}{\left(angle \cdot \left({b}^{2} \cdot \mathsf{PI}\left(\right)\right)\right)} \]
    3. *-commutativeN/A

      \[\leadsto \frac{1}{90} \cdot \left(angle \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot {b}^{2}\right)}\right) \]
    4. lower-*.f64N/A

      \[\leadsto \frac{1}{90} \cdot \left(angle \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot {b}^{2}\right)}\right) \]
    5. lower-PI.f64N/A

      \[\leadsto \frac{1}{90} \cdot \left(angle \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot {b}^{2}\right)\right) \]
    6. unpow2N/A

      \[\leadsto \frac{1}{90} \cdot \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(b \cdot b\right)}\right)\right) \]
    7. lower-*.f6436.8

      \[\leadsto 0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \color{blue}{\left(b \cdot b\right)}\right)\right) \]
  9. Applied rewrites36.8%

    \[\leadsto \color{blue}{0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \left(b \cdot b\right)\right)\right)} \]
  10. Step-by-step derivation
    1. lift-PI.f64N/A

      \[\leadsto \frac{1}{90} \cdot \left(angle \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \left(b \cdot b\right)\right)\right) \]
    2. lift-*.f64N/A

      \[\leadsto \frac{1}{90} \cdot \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(b \cdot b\right)}\right)\right) \]
    3. associate-*r*N/A

      \[\leadsto \frac{1}{90} \cdot \color{blue}{\left(\left(angle \cdot \mathsf{PI}\left(\right)\right) \cdot \left(b \cdot b\right)\right)} \]
    4. lift-*.f64N/A

      \[\leadsto \frac{1}{90} \cdot \left(\color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)} \cdot \left(b \cdot b\right)\right) \]
    5. lift-*.f64N/A

      \[\leadsto \frac{1}{90} \cdot \left(\left(angle \cdot \mathsf{PI}\left(\right)\right) \cdot \color{blue}{\left(b \cdot b\right)}\right) \]
    6. associate-*r*N/A

      \[\leadsto \frac{1}{90} \cdot \color{blue}{\left(\left(\left(angle \cdot \mathsf{PI}\left(\right)\right) \cdot b\right) \cdot b\right)} \]
    7. lower-*.f64N/A

      \[\leadsto \frac{1}{90} \cdot \color{blue}{\left(\left(\left(angle \cdot \mathsf{PI}\left(\right)\right) \cdot b\right) \cdot b\right)} \]
    8. lower-*.f6438.9

      \[\leadsto 0.011111111111111112 \cdot \left(\color{blue}{\left(\left(angle \cdot \pi\right) \cdot b\right)} \cdot b\right) \]
    9. lift-*.f64N/A

      \[\leadsto \frac{1}{90} \cdot \left(\left(\color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)} \cdot b\right) \cdot b\right) \]
    10. *-commutativeN/A

      \[\leadsto \frac{1}{90} \cdot \left(\left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot angle\right)} \cdot b\right) \cdot b\right) \]
    11. lift-*.f6438.9

      \[\leadsto 0.011111111111111112 \cdot \left(\left(\color{blue}{\left(\pi \cdot angle\right)} \cdot b\right) \cdot b\right) \]
  11. Applied rewrites38.9%

    \[\leadsto 0.011111111111111112 \cdot \color{blue}{\left(\left(\left(\pi \cdot angle\right) \cdot b\right) \cdot b\right)} \]
  12. Final simplification38.9%

    \[\leadsto 0.011111111111111112 \cdot \left(b \cdot \left(b \cdot \left(\pi \cdot angle\right)\right)\right) \]
  13. Add Preprocessing

Alternative 13: 34.8% accurate, 21.6× speedup?

\[\begin{array}{l} a_m = \left|a\right| \\ 0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \left(b \cdot b\right)\right)\right) \end{array} \]
a_m = (fabs.f64 a)
(FPCore (a_m b angle)
 :precision binary64
 (* 0.011111111111111112 (* angle (* PI (* b b)))))
a_m = fabs(a);
double code(double a_m, double b, double angle) {
	return 0.011111111111111112 * (angle * (((double) M_PI) * (b * b)));
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle) {
	return 0.011111111111111112 * (angle * (Math.PI * (b * b)));
}
a_m = math.fabs(a)
def code(a_m, b, angle):
	return 0.011111111111111112 * (angle * (math.pi * (b * b)))
a_m = abs(a)
function code(a_m, b, angle)
	return Float64(0.011111111111111112 * Float64(angle * Float64(pi * Float64(b * b))))
end
a_m = abs(a);
function tmp = code(a_m, b, angle)
	tmp = 0.011111111111111112 * (angle * (pi * (b * b)));
end
a_m = N[Abs[a], $MachinePrecision]
code[a$95$m_, b_, angle_] := N[(0.011111111111111112 * N[(angle * N[(Pi * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|

\\
0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \left(b \cdot b\right)\right)\right)
\end{array}
Derivation
  1. Initial program 52.3%

    \[\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. Applied rewrites63.3%

    \[\leadsto \color{blue}{\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right)\right)} \]
  4. Taylor expanded in b around inf

    \[\leadsto \color{blue}{{b}^{2} \cdot \sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \]
  5. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \color{blue}{\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {b}^{2}} \]
    2. lower-*.f64N/A

      \[\leadsto \color{blue}{\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {b}^{2}} \]
    3. lower-sin.f64N/A

      \[\leadsto \color{blue}{\sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot {b}^{2} \]
    4. lower-*.f64N/A

      \[\leadsto \sin \color{blue}{\left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)} \cdot {b}^{2} \]
    5. lower-*.f64N/A

      \[\leadsto \sin \left(\frac{1}{90} \cdot \color{blue}{\left(angle \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot {b}^{2} \]
    6. lower-PI.f64N/A

      \[\leadsto \sin \left(\frac{1}{90} \cdot \left(angle \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \cdot {b}^{2} \]
    7. unpow2N/A

      \[\leadsto \sin \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \color{blue}{\left(b \cdot b\right)} \]
    8. lower-*.f6436.7

      \[\leadsto \sin \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot \color{blue}{\left(b \cdot b\right)} \]
  6. Applied rewrites36.7%

    \[\leadsto \color{blue}{\sin \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(b \cdot b\right)} \]
  7. Taylor expanded in angle around 0

    \[\leadsto \color{blue}{\frac{1}{90} \cdot \left(angle \cdot \left({b}^{2} \cdot \mathsf{PI}\left(\right)\right)\right)} \]
  8. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto \color{blue}{\frac{1}{90} \cdot \left(angle \cdot \left({b}^{2} \cdot \mathsf{PI}\left(\right)\right)\right)} \]
    2. lower-*.f64N/A

      \[\leadsto \frac{1}{90} \cdot \color{blue}{\left(angle \cdot \left({b}^{2} \cdot \mathsf{PI}\left(\right)\right)\right)} \]
    3. *-commutativeN/A

      \[\leadsto \frac{1}{90} \cdot \left(angle \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot {b}^{2}\right)}\right) \]
    4. lower-*.f64N/A

      \[\leadsto \frac{1}{90} \cdot \left(angle \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot {b}^{2}\right)}\right) \]
    5. lower-PI.f64N/A

      \[\leadsto \frac{1}{90} \cdot \left(angle \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot {b}^{2}\right)\right) \]
    6. unpow2N/A

      \[\leadsto \frac{1}{90} \cdot \left(angle \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(b \cdot b\right)}\right)\right) \]
    7. lower-*.f6436.8

      \[\leadsto 0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \color{blue}{\left(b \cdot b\right)}\right)\right) \]
  9. Applied rewrites36.8%

    \[\leadsto \color{blue}{0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \left(b \cdot b\right)\right)\right)} \]
  10. Add Preprocessing

Reproduce

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