ab-angle->ABCF C

Percentage Accurate: 79.8% → 79.8%
Time: 15.8s
Alternatives: 11
Speedup: 2.0×

Specification

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

\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
{\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2}
\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 11 alternatives:

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

Initial Program: 79.8% accurate, 1.0× speedup?

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

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

Alternative 1: 79.8% accurate, 0.6× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ \begin{array}{l} t_0 := \pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\\ {\left(a \cdot \cos \left({\left(e^{2}\right)}^{\left(0.5 \cdot \log t\_0\right)}\right)\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2} \end{array} \end{array} \]
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
 :precision binary64
 (let* ((t_0 (* PI (* angle_m 0.005555555555555556))))
   (+
    (pow (* a (cos (pow (exp 2.0) (* 0.5 (log t_0))))) 2.0)
    (pow (* b (sin t_0)) 2.0))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
	double t_0 = ((double) M_PI) * (angle_m * 0.005555555555555556);
	return pow((a * cos(pow(exp(2.0), (0.5 * log(t_0))))), 2.0) + pow((b * sin(t_0)), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
	double t_0 = Math.PI * (angle_m * 0.005555555555555556);
	return Math.pow((a * Math.cos(Math.pow(Math.exp(2.0), (0.5 * Math.log(t_0))))), 2.0) + Math.pow((b * Math.sin(t_0)), 2.0);
}
angle_m = math.fabs(angle)
def code(a, b, angle_m):
	t_0 = math.pi * (angle_m * 0.005555555555555556)
	return math.pow((a * math.cos(math.pow(math.exp(2.0), (0.5 * math.log(t_0))))), 2.0) + math.pow((b * math.sin(t_0)), 2.0)
angle_m = abs(angle)
function code(a, b, angle_m)
	t_0 = Float64(pi * Float64(angle_m * 0.005555555555555556))
	return Float64((Float64(a * cos((exp(2.0) ^ Float64(0.5 * log(t_0))))) ^ 2.0) + (Float64(b * sin(t_0)) ^ 2.0))
end
angle_m = abs(angle);
function tmp = code(a, b, angle_m)
	t_0 = pi * (angle_m * 0.005555555555555556);
	tmp = ((a * cos((exp(2.0) ^ (0.5 * log(t_0))))) ^ 2.0) + ((b * sin(t_0)) ^ 2.0);
end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[N[(a * N[Cos[N[Power[N[Exp[2.0], $MachinePrecision], N[(0.5 * N[Log[t$95$0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|

\\
\begin{array}{l}
t_0 := \pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\\
{\left(a \cdot \cos \left({\left(e^{2}\right)}^{\left(0.5 \cdot \log t\_0\right)}\right)\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2}
\end{array}
\end{array}
Derivation
  1. Initial program 80.7%

    \[{\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-PI.f64N/A

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

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

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

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

      \[\leadsto {\left(a \cdot \cos \left(\frac{1}{\color{blue}{\frac{180}{\mathsf{PI}\left(\right) \cdot angle}}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
    6. lower-*.f6480.6

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

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

      \[\leadsto {\left(a \cdot \cos \left(\frac{1}{\frac{180}{\mathsf{PI}\left(\right) \cdot angle}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(angle \cdot \frac{1}{180}\right)}\right)\right)}^{2} \]
    2. metadata-evalN/A

      \[\leadsto {\left(a \cdot \cos \left(\frac{1}{\frac{180}{\mathsf{PI}\left(\right) \cdot angle}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \color{blue}{\frac{1}{180}}\right)\right)\right)}^{2} \]
    3. lift-*.f6480.6

      \[\leadsto {\left(a \cdot \cos \left(\frac{1}{\frac{180}{\pi \cdot angle}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \color{blue}{\left(angle \cdot 0.005555555555555556\right)}\right)\right)}^{2} \]
  6. Applied rewrites80.6%

    \[\leadsto {\left(a \cdot \cos \left(\frac{1}{\frac{180}{\pi \cdot angle}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \color{blue}{\left(angle \cdot 0.005555555555555556\right)}\right)\right)}^{2} \]
  7. Step-by-step derivation
    1. lift-PI.f64N/A

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

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

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)}^{2} \]
    4. div-invN/A

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

      \[\leadsto {\left(a \cdot \cos \left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot angle\right)} \cdot \frac{1}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)}^{2} \]
    6. metadata-evalN/A

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

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

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(angle \cdot \frac{1}{180}\right)}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)}^{2} \]
    9. lift-*.f6480.7

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
    10. unpow1N/A

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left({\left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)}^{1}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)}^{2} \]
    11. metadata-evalN/A

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

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left({\left({\left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)}^{\frac{1}{2}}\right)}^{2}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)}^{2} \]
    13. pow-to-expN/A

      \[\leadsto {\left(a \cdot \cos \left({\color{blue}{\left(e^{\log \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right) \cdot \frac{1}{2}}\right)}}^{2}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)}^{2} \]
    14. pow-expN/A

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left(e^{\left(\log \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right) \cdot \frac{1}{2}\right) \cdot 2}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)}^{2} \]
    15. *-commutativeN/A

      \[\leadsto {\left(a \cdot \cos \left(e^{\color{blue}{2 \cdot \left(\log \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right) \cdot \frac{1}{2}\right)}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)}^{2} \]
    16. exp-prodN/A

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left({\left(e^{2}\right)}^{\left(\log \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right) \cdot \frac{1}{2}\right)}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)}^{2} \]
    17. lower-pow.f64N/A

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left({\left(e^{2}\right)}^{\left(\log \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right) \cdot \frac{1}{2}\right)}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)}^{2} \]
    18. lower-exp.f64N/A

      \[\leadsto {\left(a \cdot \cos \left({\color{blue}{\left(e^{2}\right)}}^{\left(\log \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right) \cdot \frac{1}{2}\right)}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)}^{2} \]
    19. *-commutativeN/A

      \[\leadsto {\left(a \cdot \cos \left({\left(e^{2}\right)}^{\color{blue}{\left(\frac{1}{2} \cdot \log \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)}^{2} \]
    20. lower-*.f64N/A

      \[\leadsto {\left(a \cdot \cos \left({\left(e^{2}\right)}^{\color{blue}{\left(\frac{1}{2} \cdot \log \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)}^{2} \]
    21. lower-log.f6441.0

      \[\leadsto {\left(a \cdot \cos \left({\left(e^{2}\right)}^{\left(0.5 \cdot \color{blue}{\log \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)}\right)}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
  8. Applied rewrites41.0%

    \[\leadsto {\left(a \cdot \cos \color{blue}{\left({\left(e^{2}\right)}^{\left(0.5 \cdot \log \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
  9. Add Preprocessing

Alternative 2: 79.8% accurate, 0.7× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ {\left(b \cdot \sin \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(a \cdot \cos \left(\pi \cdot e^{\log \left(angle\_m \cdot 0.005555555555555556\right)}\right)\right)}^{2} \end{array} \]
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
 :precision binary64
 (+
  (pow (* b (sin (* PI (* angle_m 0.005555555555555556)))) 2.0)
  (pow (* a (cos (* PI (exp (log (* angle_m 0.005555555555555556)))))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
	return pow((b * sin((((double) M_PI) * (angle_m * 0.005555555555555556)))), 2.0) + pow((a * cos((((double) M_PI) * exp(log((angle_m * 0.005555555555555556)))))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
	return Math.pow((b * Math.sin((Math.PI * (angle_m * 0.005555555555555556)))), 2.0) + Math.pow((a * Math.cos((Math.PI * Math.exp(Math.log((angle_m * 0.005555555555555556)))))), 2.0);
}
angle_m = math.fabs(angle)
def code(a, b, angle_m):
	return math.pow((b * math.sin((math.pi * (angle_m * 0.005555555555555556)))), 2.0) + math.pow((a * math.cos((math.pi * math.exp(math.log((angle_m * 0.005555555555555556)))))), 2.0)
angle_m = abs(angle)
function code(a, b, angle_m)
	return Float64((Float64(b * sin(Float64(pi * Float64(angle_m * 0.005555555555555556)))) ^ 2.0) + (Float64(a * cos(Float64(pi * exp(log(Float64(angle_m * 0.005555555555555556)))))) ^ 2.0))
end
angle_m = abs(angle);
function tmp = code(a, b, angle_m)
	tmp = ((b * sin((pi * (angle_m * 0.005555555555555556)))) ^ 2.0) + ((a * cos((pi * exp(log((angle_m * 0.005555555555555556)))))) ^ 2.0);
end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := N[(N[Power[N[(b * N[Sin[N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Cos[N[(Pi * N[Exp[N[Log[N[(angle$95$m * 0.005555555555555556), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|

\\
{\left(b \cdot \sin \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(a \cdot \cos \left(\pi \cdot e^{\log \left(angle\_m \cdot 0.005555555555555556\right)}\right)\right)}^{2}
\end{array}
Derivation
  1. Initial program 80.7%

    \[{\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-PI.f64N/A

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

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

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

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

      \[\leadsto {\left(a \cdot \cos \left(\frac{1}{\color{blue}{\frac{180}{\mathsf{PI}\left(\right) \cdot angle}}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
    6. lower-*.f6480.6

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

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

      \[\leadsto {\left(a \cdot \cos \left(\frac{1}{\frac{180}{\mathsf{PI}\left(\right) \cdot angle}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(angle \cdot \frac{1}{180}\right)}\right)\right)}^{2} \]
    2. metadata-evalN/A

      \[\leadsto {\left(a \cdot \cos \left(\frac{1}{\frac{180}{\mathsf{PI}\left(\right) \cdot angle}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \color{blue}{\frac{1}{180}}\right)\right)\right)}^{2} \]
    3. lift-*.f6480.6

      \[\leadsto {\left(a \cdot \cos \left(\frac{1}{\frac{180}{\pi \cdot angle}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \color{blue}{\left(angle \cdot 0.005555555555555556\right)}\right)\right)}^{2} \]
  6. Applied rewrites80.6%

    \[\leadsto {\left(a \cdot \cos \left(\frac{1}{\frac{180}{\pi \cdot angle}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \color{blue}{\left(angle \cdot 0.005555555555555556\right)}\right)\right)}^{2} \]
  7. Step-by-step derivation
    1. lift-PI.f64N/A

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

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

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)}^{2} \]
    4. div-invN/A

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

      \[\leadsto {\left(a \cdot \cos \left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot angle\right)} \cdot \frac{1}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)}^{2} \]
    6. metadata-evalN/A

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

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

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(angle \cdot \frac{1}{180}\right)}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)}^{2} \]
    9. lift-*.f6480.7

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
    10. rem-exp-logN/A

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

      \[\leadsto {\left(a \cdot \cos \left(e^{\log \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)}^{2} \]
    12. *-commutativeN/A

      \[\leadsto {\left(a \cdot \cos \left(e^{\log \color{blue}{\left(\left(angle \cdot \frac{1}{180}\right) \cdot \mathsf{PI}\left(\right)\right)}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)}^{2} \]
    13. log-prodN/A

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

      \[\leadsto {\left(a \cdot \cos \left(e^{\log \left(angle \cdot \frac{1}{180}\right) + \log \color{blue}{\mathsf{PI}\left(\right)}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)}^{2} \]
    15. exp-sumN/A

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left(e^{\log \left(angle \cdot \frac{1}{180}\right)} \cdot e^{\log \mathsf{PI}\left(\right)}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)}^{2} \]
    16. add-exp-logN/A

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

      \[\leadsto {\left(a \cdot \cos \left(e^{\log \left(angle \cdot \frac{1}{180}\right)} \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)}^{2} \]
    18. lower-*.f64N/A

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left(e^{\log \left(angle \cdot \frac{1}{180}\right)} \cdot \mathsf{PI}\left(\right)\right)}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)}^{2} \]
    19. lower-exp.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\color{blue}{e^{\log \left(angle \cdot \frac{1}{180}\right)}} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)}^{2} \]
    20. lower-log.f6440.9

      \[\leadsto {\left(a \cdot \cos \left(e^{\color{blue}{\log \left(angle \cdot 0.005555555555555556\right)}} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
  8. Applied rewrites40.9%

    \[\leadsto {\left(a \cdot \cos \color{blue}{\left(e^{\log \left(angle \cdot 0.005555555555555556\right)} \cdot \pi\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
  9. Final simplification40.9%

    \[\leadsto {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(a \cdot \cos \left(\pi \cdot e^{\log \left(angle \cdot 0.005555555555555556\right)}\right)\right)}^{2} \]
  10. Add Preprocessing

Alternative 3: 79.7% accurate, 0.8× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ {\left(a \cdot \cos \left({\left(\sqrt{angle\_m \cdot 0.005555555555555556} \cdot \sqrt{\pi}\right)}^{2}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle\_m}{180}\right)\right)}^{2} \end{array} \]
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
 :precision binary64
 (+
  (pow
   (* a (cos (pow (* (sqrt (* angle_m 0.005555555555555556)) (sqrt PI)) 2.0)))
   2.0)
  (pow (* b (sin (* PI (/ angle_m 180.0)))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
	return pow((a * cos(pow((sqrt((angle_m * 0.005555555555555556)) * sqrt(((double) M_PI))), 2.0))), 2.0) + pow((b * sin((((double) M_PI) * (angle_m / 180.0)))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
	return Math.pow((a * Math.cos(Math.pow((Math.sqrt((angle_m * 0.005555555555555556)) * Math.sqrt(Math.PI)), 2.0))), 2.0) + Math.pow((b * Math.sin((Math.PI * (angle_m / 180.0)))), 2.0);
}
angle_m = math.fabs(angle)
def code(a, b, angle_m):
	return math.pow((a * math.cos(math.pow((math.sqrt((angle_m * 0.005555555555555556)) * math.sqrt(math.pi)), 2.0))), 2.0) + math.pow((b * math.sin((math.pi * (angle_m / 180.0)))), 2.0)
angle_m = abs(angle)
function code(a, b, angle_m)
	return Float64((Float64(a * cos((Float64(sqrt(Float64(angle_m * 0.005555555555555556)) * sqrt(pi)) ^ 2.0))) ^ 2.0) + (Float64(b * sin(Float64(pi * Float64(angle_m / 180.0)))) ^ 2.0))
end
angle_m = abs(angle);
function tmp = code(a, b, angle_m)
	tmp = ((a * cos(((sqrt((angle_m * 0.005555555555555556)) * sqrt(pi)) ^ 2.0))) ^ 2.0) + ((b * sin((pi * (angle_m / 180.0)))) ^ 2.0);
end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := N[(N[Power[N[(a * N[Cos[N[Power[N[(N[Sqrt[N[(angle$95$m * 0.005555555555555556), $MachinePrecision]], $MachinePrecision] * N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|

\\
{\left(a \cdot \cos \left({\left(\sqrt{angle\_m \cdot 0.005555555555555556} \cdot \sqrt{\pi}\right)}^{2}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle\_m}{180}\right)\right)}^{2}
\end{array}
Derivation
  1. Initial program 80.7%

    \[{\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-PI.f64N/A

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

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

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

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

      \[\leadsto {\left(a \cdot \cos \left(\frac{1}{\color{blue}{\frac{180}{\mathsf{PI}\left(\right) \cdot angle}}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
    6. lower-*.f6480.6

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

    \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\frac{1}{\frac{180}{\pi \cdot angle}}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
  5. Step-by-step derivation
    1. lift-PI.f64N/A

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

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

      \[\leadsto {\left(a \cdot \cos \left(\frac{1}{\color{blue}{\frac{180}{\mathsf{PI}\left(\right) \cdot angle}}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
    4. /-rgt-identityN/A

      \[\leadsto {\left(a \cdot \cos \left(\frac{1}{\color{blue}{\frac{\frac{180}{\mathsf{PI}\left(\right) \cdot angle}}{1}}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
    5. clear-numN/A

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\frac{1}{\frac{180}{\mathsf{PI}\left(\right) \cdot angle}}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
    6. inv-powN/A

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left({\left(\frac{180}{\mathsf{PI}\left(\right) \cdot angle}\right)}^{-1}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
    7. sqr-powN/A

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

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

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left({\left({\left(\frac{180}{\mathsf{PI}\left(\right) \cdot angle}\right)}^{\left(\frac{-1}{2}\right)}\right)}^{2}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
  6. Applied rewrites40.9%

    \[\leadsto {\left(a \cdot \cos \color{blue}{\left({\left({\left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)}^{0.5}\right)}^{2}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
  7. Step-by-step derivation
    1. lift-PI.f64N/A

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

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

      \[\leadsto {\left(a \cdot \cos \left({\left({\color{blue}{\left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)}}^{\frac{1}{2}}\right)}^{2}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
    4. unpow1N/A

      \[\leadsto {\left(a \cdot \cos \left({\left({\color{blue}{\left({\left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)}^{1}\right)}}^{\frac{1}{2}}\right)}^{2}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
    5. metadata-evalN/A

      \[\leadsto {\left(a \cdot \cos \left({\left({\left({\left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)}^{\color{blue}{\left(\frac{1}{2} \cdot 2\right)}}\right)}^{\frac{1}{2}}\right)}^{2}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
    6. pow-powN/A

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

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

      \[\leadsto {\left(a \cdot \cos \left({\left({\left({\color{blue}{\left({\left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)}^{\frac{1}{2}}\right)}}^{2}\right)}^{\frac{1}{2}}\right)}^{2}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
    9. pow-powN/A

      \[\leadsto {\left(a \cdot \cos \left({\left({\color{blue}{\left({\left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)}^{\left(\frac{1}{2} \cdot 2\right)}\right)}}^{\frac{1}{2}}\right)}^{2}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
    10. metadata-evalN/A

      \[\leadsto {\left(a \cdot \cos \left({\left({\left({\left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)}^{\color{blue}{1}}\right)}^{\frac{1}{2}}\right)}^{2}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
    11. unpow1N/A

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

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

      \[\leadsto {\left(a \cdot \cos \left({\left({\color{blue}{\left(\left(angle \cdot \frac{1}{180}\right) \cdot \mathsf{PI}\left(\right)\right)}}^{\frac{1}{2}}\right)}^{2}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
    14. unpow-prod-downN/A

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

      \[\leadsto {\left(a \cdot \cos \left({\color{blue}{\left({\left(angle \cdot \frac{1}{180}\right)}^{\frac{1}{2}} \cdot {\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right)}}^{2}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
    16. unpow1/2N/A

      \[\leadsto {\left(a \cdot \cos \left({\left(\color{blue}{\sqrt{angle \cdot \frac{1}{180}}} \cdot {\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right)}^{2}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
    17. lower-sqrt.f64N/A

      \[\leadsto {\left(a \cdot \cos \left({\left(\color{blue}{\sqrt{angle \cdot \frac{1}{180}}} \cdot {\mathsf{PI}\left(\right)}^{\frac{1}{2}}\right)}^{2}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
    18. pow1/2N/A

      \[\leadsto {\left(a \cdot \cos \left({\left(\sqrt{angle \cdot \frac{1}{180}} \cdot \color{blue}{\sqrt{\mathsf{PI}\left(\right)}}\right)}^{2}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
    19. lower-sqrt.f6440.9

      \[\leadsto {\left(a \cdot \cos \left({\left(\sqrt{angle \cdot 0.005555555555555556} \cdot \color{blue}{\sqrt{\pi}}\right)}^{2}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
  8. Applied rewrites40.9%

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

Alternative 4: 79.8% accurate, 1.0× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ \begin{array}{l} t_0 := \pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\\ t_1 := \sqrt{t\_0}\\ {\left(b \cdot \sin t\_0\right)}^{2} + {\left(a \cdot \cos \left(t\_1 \cdot t\_1\right)\right)}^{2} \end{array} \end{array} \]
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
 :precision binary64
 (let* ((t_0 (* PI (* angle_m 0.005555555555555556))) (t_1 (sqrt t_0)))
   (+ (pow (* b (sin t_0)) 2.0) (pow (* a (cos (* t_1 t_1))) 2.0))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
	double t_0 = ((double) M_PI) * (angle_m * 0.005555555555555556);
	double t_1 = sqrt(t_0);
	return pow((b * sin(t_0)), 2.0) + pow((a * cos((t_1 * t_1))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
	double t_0 = Math.PI * (angle_m * 0.005555555555555556);
	double t_1 = Math.sqrt(t_0);
	return Math.pow((b * Math.sin(t_0)), 2.0) + Math.pow((a * Math.cos((t_1 * t_1))), 2.0);
}
angle_m = math.fabs(angle)
def code(a, b, angle_m):
	t_0 = math.pi * (angle_m * 0.005555555555555556)
	t_1 = math.sqrt(t_0)
	return math.pow((b * math.sin(t_0)), 2.0) + math.pow((a * math.cos((t_1 * t_1))), 2.0)
angle_m = abs(angle)
function code(a, b, angle_m)
	t_0 = Float64(pi * Float64(angle_m * 0.005555555555555556))
	t_1 = sqrt(t_0)
	return Float64((Float64(b * sin(t_0)) ^ 2.0) + (Float64(a * cos(Float64(t_1 * t_1))) ^ 2.0))
end
angle_m = abs(angle);
function tmp = code(a, b, angle_m)
	t_0 = pi * (angle_m * 0.005555555555555556);
	t_1 = sqrt(t_0);
	tmp = ((b * sin(t_0)) ^ 2.0) + ((a * cos((t_1 * t_1))) ^ 2.0);
end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[t$95$0], $MachinePrecision]}, N[(N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Cos[N[(t$95$1 * t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
angle_m = \left|angle\right|

\\
\begin{array}{l}
t_0 := \pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\\
t_1 := \sqrt{t\_0}\\
{\left(b \cdot \sin t\_0\right)}^{2} + {\left(a \cdot \cos \left(t\_1 \cdot t\_1\right)\right)}^{2}
\end{array}
\end{array}
Derivation
  1. Initial program 80.7%

    \[{\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-PI.f64N/A

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

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

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

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

      \[\leadsto {\left(a \cdot \cos \left(\frac{1}{\color{blue}{\frac{180}{\mathsf{PI}\left(\right) \cdot angle}}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
    6. lower-*.f6480.6

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

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

      \[\leadsto {\left(a \cdot \cos \left(\frac{1}{\frac{180}{\mathsf{PI}\left(\right) \cdot angle}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(angle \cdot \frac{1}{180}\right)}\right)\right)}^{2} \]
    2. metadata-evalN/A

      \[\leadsto {\left(a \cdot \cos \left(\frac{1}{\frac{180}{\mathsf{PI}\left(\right) \cdot angle}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \color{blue}{\frac{1}{180}}\right)\right)\right)}^{2} \]
    3. lift-*.f6480.6

      \[\leadsto {\left(a \cdot \cos \left(\frac{1}{\frac{180}{\pi \cdot angle}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \color{blue}{\left(angle \cdot 0.005555555555555556\right)}\right)\right)}^{2} \]
  6. Applied rewrites80.6%

    \[\leadsto {\left(a \cdot \cos \left(\frac{1}{\frac{180}{\pi \cdot angle}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \color{blue}{\left(angle \cdot 0.005555555555555556\right)}\right)\right)}^{2} \]
  7. Step-by-step derivation
    1. lift-PI.f64N/A

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

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

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)}^{2} \]
    4. div-invN/A

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

      \[\leadsto {\left(a \cdot \cos \left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot angle\right)} \cdot \frac{1}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)}^{2} \]
    6. metadata-evalN/A

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

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

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(angle \cdot \frac{1}{180}\right)}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)}^{2} \]
    9. lift-*.f6480.7

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
    10. unpow1N/A

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left({\left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)}^{1}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)}^{2} \]
    11. metadata-evalN/A

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

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

      \[\leadsto {\left(a \cdot \cos \left({\color{blue}{\left({\left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)}^{\frac{1}{2}}\right)}}^{2}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)}^{2} \]
    14. unpow2N/A

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left({\left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)}^{\frac{1}{2}} \cdot {\left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)}^{\frac{1}{2}}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)}^{2} \]
    15. lower-*.f6440.9

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left({\left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)}^{0.5} \cdot {\left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)}^{0.5}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
    16. lift-pow.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\color{blue}{{\left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)}^{\frac{1}{2}}} \cdot {\left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)}^{\frac{1}{2}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)}^{2} \]
    17. unpow1/2N/A

      \[\leadsto {\left(a \cdot \cos \left(\color{blue}{\sqrt{\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)}} \cdot {\left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)}^{\frac{1}{2}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)}^{2} \]
    18. lower-sqrt.f6440.9

      \[\leadsto {\left(a \cdot \cos \left(\color{blue}{\sqrt{\pi \cdot \left(angle \cdot 0.005555555555555556\right)}} \cdot {\left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)}^{0.5}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
    19. lift-pow.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\sqrt{\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)} \cdot \color{blue}{{\left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)}^{\frac{1}{2}}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)}^{2} \]
    20. unpow1/2N/A

      \[\leadsto {\left(a \cdot \cos \left(\sqrt{\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)} \cdot \color{blue}{\sqrt{\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)}^{2} \]
    21. lower-sqrt.f6440.9

      \[\leadsto {\left(a \cdot \cos \left(\sqrt{\pi \cdot \left(angle \cdot 0.005555555555555556\right)} \cdot \color{blue}{\sqrt{\pi \cdot \left(angle \cdot 0.005555555555555556\right)}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
  8. Applied rewrites40.9%

    \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\sqrt{\pi \cdot \left(angle \cdot 0.005555555555555556\right)} \cdot \sqrt{\pi \cdot \left(angle \cdot 0.005555555555555556\right)}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
  9. Final simplification40.9%

    \[\leadsto {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(a \cdot \cos \left(\sqrt{\pi \cdot \left(angle \cdot 0.005555555555555556\right)} \cdot \sqrt{\pi \cdot \left(angle \cdot 0.005555555555555556\right)}\right)\right)}^{2} \]
  10. Add Preprocessing

Alternative 5: 79.8% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle\_m}{180}\\
{\left(b \cdot \sin t\_0\right)}^{2} + {\left(a \cdot \cos t\_0\right)}^{2}
\end{array}
\end{array}
Derivation
  1. Initial program 80.7%

    \[{\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
  2. Add Preprocessing
  3. Final simplification80.7%

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

Alternative 6: 79.8% accurate, 1.9× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ {\left(b \cdot \sin \left(\pi \cdot \frac{angle\_m}{180}\right)\right)}^{2} + a \cdot a \end{array} \]
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
 :precision binary64
 (+ (pow (* b (sin (* PI (/ angle_m 180.0)))) 2.0) (* a a)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
	return pow((b * sin((((double) M_PI) * (angle_m / 180.0)))), 2.0) + (a * a);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
	return Math.pow((b * Math.sin((Math.PI * (angle_m / 180.0)))), 2.0) + (a * a);
}
angle_m = math.fabs(angle)
def code(a, b, angle_m):
	return math.pow((b * math.sin((math.pi * (angle_m / 180.0)))), 2.0) + (a * a)
angle_m = abs(angle)
function code(a, b, angle_m)
	return Float64((Float64(b * sin(Float64(pi * Float64(angle_m / 180.0)))) ^ 2.0) + Float64(a * a))
end
angle_m = abs(angle);
function tmp = code(a, b, angle_m)
	tmp = ((b * sin((pi * (angle_m / 180.0)))) ^ 2.0) + (a * a);
end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := N[(N[Power[N[(b * N[Sin[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(a * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|

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

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

    \[\leadsto \color{blue}{{a}^{2}} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
  4. Step-by-step derivation
    1. unpow2N/A

      \[\leadsto \color{blue}{a \cdot a} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
    2. lower-*.f6480.6

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

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

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

Alternative 7: 79.8% accurate, 2.0× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ {\left(b \cdot \sin \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)}^{2} + a \cdot a \end{array} \]
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
 :precision binary64
 (+ (pow (* b (sin (* PI (* angle_m 0.005555555555555556)))) 2.0) (* a a)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
	return pow((b * sin((((double) M_PI) * (angle_m * 0.005555555555555556)))), 2.0) + (a * a);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
	return Math.pow((b * Math.sin((Math.PI * (angle_m * 0.005555555555555556)))), 2.0) + (a * a);
}
angle_m = math.fabs(angle)
def code(a, b, angle_m):
	return math.pow((b * math.sin((math.pi * (angle_m * 0.005555555555555556)))), 2.0) + (a * a)
angle_m = abs(angle)
function code(a, b, angle_m)
	return Float64((Float64(b * sin(Float64(pi * Float64(angle_m * 0.005555555555555556)))) ^ 2.0) + Float64(a * a))
end
angle_m = abs(angle);
function tmp = code(a, b, angle_m)
	tmp = ((b * sin((pi * (angle_m * 0.005555555555555556)))) ^ 2.0) + (a * a);
end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := N[(N[Power[N[(b * N[Sin[N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(a * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|

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

    \[{\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-PI.f64N/A

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

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

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

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

      \[\leadsto {\left(a \cdot \cos \left(\frac{1}{\color{blue}{\frac{180}{\mathsf{PI}\left(\right) \cdot angle}}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} \]
    6. lower-*.f6480.6

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

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

      \[\leadsto {\left(a \cdot \cos \left(\frac{1}{\frac{180}{\mathsf{PI}\left(\right) \cdot angle}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(angle \cdot \frac{1}{180}\right)}\right)\right)}^{2} \]
    2. metadata-evalN/A

      \[\leadsto {\left(a \cdot \cos \left(\frac{1}{\frac{180}{\mathsf{PI}\left(\right) \cdot angle}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \color{blue}{\frac{1}{180}}\right)\right)\right)}^{2} \]
    3. lift-*.f6480.6

      \[\leadsto {\left(a \cdot \cos \left(\frac{1}{\frac{180}{\pi \cdot angle}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \color{blue}{\left(angle \cdot 0.005555555555555556\right)}\right)\right)}^{2} \]
  6. Applied rewrites80.6%

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

    \[\leadsto \color{blue}{{a}^{2}} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)}^{2} \]
  8. Step-by-step derivation
    1. unpow2N/A

      \[\leadsto \color{blue}{a \cdot a} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \left(angle \cdot \frac{1}{180}\right)\right)\right)}^{2} \]
    2. lower-*.f6480.6

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

    \[\leadsto \color{blue}{a \cdot a} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
  10. Final simplification80.6%

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

Alternative 8: 63.3% accurate, 9.1× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ \begin{array}{l} \mathbf{if}\;b \leq 1.55 \cdot 10^{-28}:\\ \;\;\;\;a \cdot a\\ \mathbf{elif}\;b \leq 1.55 \cdot 10^{+169}:\\ \;\;\;\;\mathsf{fma}\left(angle\_m \cdot angle\_m, \pi \cdot \left(\pi \cdot \left(\left(b \cdot b\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)\right), a \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;angle\_m \cdot \left(\left(angle\_m \cdot b\right) \cdot \left(3.08641975308642 \cdot 10^{-5} \cdot \left(b \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\\ \end{array} \end{array} \]
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
 :precision binary64
 (if (<= b 1.55e-28)
   (* a a)
   (if (<= b 1.55e+169)
     (fma
      (* angle_m angle_m)
      (* PI (* PI (* (* b b) 3.08641975308642e-5)))
      (* a a))
     (* angle_m (* (* angle_m b) (* 3.08641975308642e-5 (* b (* PI PI))))))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
	double tmp;
	if (b <= 1.55e-28) {
		tmp = a * a;
	} else if (b <= 1.55e+169) {
		tmp = fma((angle_m * angle_m), (((double) M_PI) * (((double) M_PI) * ((b * b) * 3.08641975308642e-5))), (a * a));
	} else {
		tmp = angle_m * ((angle_m * b) * (3.08641975308642e-5 * (b * (((double) M_PI) * ((double) M_PI)))));
	}
	return tmp;
}
angle_m = abs(angle)
function code(a, b, angle_m)
	tmp = 0.0
	if (b <= 1.55e-28)
		tmp = Float64(a * a);
	elseif (b <= 1.55e+169)
		tmp = fma(Float64(angle_m * angle_m), Float64(pi * Float64(pi * Float64(Float64(b * b) * 3.08641975308642e-5))), Float64(a * a));
	else
		tmp = Float64(angle_m * Float64(Float64(angle_m * b) * Float64(3.08641975308642e-5 * Float64(b * Float64(pi * pi)))));
	end
	return tmp
end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := If[LessEqual[b, 1.55e-28], N[(a * a), $MachinePrecision], If[LessEqual[b, 1.55e+169], N[(N[(angle$95$m * angle$95$m), $MachinePrecision] * N[(Pi * N[(Pi * N[(N[(b * b), $MachinePrecision] * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * a), $MachinePrecision]), $MachinePrecision], N[(angle$95$m * N[(N[(angle$95$m * b), $MachinePrecision] * N[(3.08641975308642e-5 * N[(b * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
angle_m = \left|angle\right|

\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.55 \cdot 10^{-28}:\\
\;\;\;\;a \cdot a\\

\mathbf{elif}\;b \leq 1.55 \cdot 10^{+169}:\\
\;\;\;\;\mathsf{fma}\left(angle\_m \cdot angle\_m, \pi \cdot \left(\pi \cdot \left(\left(b \cdot b\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)\right), a \cdot a\right)\\

\mathbf{else}:\\
\;\;\;\;angle\_m \cdot \left(\left(angle\_m \cdot b\right) \cdot \left(3.08641975308642 \cdot 10^{-5} \cdot \left(b \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < 1.54999999999999996e-28

    1. Initial program 80.3%

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

      \[\leadsto \color{blue}{{a}^{2}} \]
    4. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \color{blue}{a \cdot a} \]
      2. lower-*.f6463.7

        \[\leadsto \color{blue}{a \cdot a} \]
    5. Applied rewrites63.7%

      \[\leadsto \color{blue}{a \cdot a} \]

    if 1.54999999999999996e-28 < b < 1.55e169

    1. Initial program 69.7%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left({angle}^{2}, \frac{-1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right), {a}^{2}\right)} \]
    5. Applied rewrites36.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(angle \cdot angle, \pi \cdot \left(\pi \cdot \mathsf{fma}\left(b \cdot b, 3.08641975308642 \cdot 10^{-5}, \left(a \cdot a\right) \cdot -3.08641975308642 \cdot 10^{-5}\right)\right), a \cdot a\right)} \]
    6. Taylor expanded in b around inf

      \[\leadsto \mathsf{fma}\left(angle \cdot angle, \mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\left(\frac{1}{32400} \cdot {b}^{2}\right)}\right), a \cdot a\right) \]
    7. Step-by-step derivation
      1. *-commutativeN/A

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

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

        \[\leadsto \mathsf{fma}\left(angle \cdot angle, \mathsf{PI}\left(\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\color{blue}{\left(b \cdot b\right)} \cdot \frac{1}{32400}\right)\right), a \cdot a\right) \]
      4. lower-*.f6461.8

        \[\leadsto \mathsf{fma}\left(angle \cdot angle, \pi \cdot \left(\pi \cdot \left(\color{blue}{\left(b \cdot b\right)} \cdot 3.08641975308642 \cdot 10^{-5}\right)\right), a \cdot a\right) \]
    8. Applied rewrites61.8%

      \[\leadsto \mathsf{fma}\left(angle \cdot angle, \pi \cdot \left(\pi \cdot \color{blue}{\left(\left(b \cdot b\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)}\right), a \cdot a\right) \]

    if 1.55e169 < b

    1. Initial program 99.8%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left({angle}^{2}, \frac{-1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right), {a}^{2}\right)} \]
    5. Applied rewrites59.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(angle \cdot angle, \pi \cdot \left(\pi \cdot \mathsf{fma}\left(b \cdot b, 3.08641975308642 \cdot 10^{-5}, \left(a \cdot a\right) \cdot -3.08641975308642 \cdot 10^{-5}\right)\right), a \cdot a\right)} \]
    6. Taylor expanded in b around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(angle \cdot angle\right) \cdot \left(\left(b \cdot b\right) \cdot \left(\left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{1}{32400}\right)\right) \]
      18. lower-PI.f6474.5

        \[\leadsto \left(angle \cdot angle\right) \cdot \left(\left(b \cdot b\right) \cdot \left(\left(\pi \cdot \color{blue}{\pi}\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)\right) \]
    8. Applied rewrites74.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(angle \cdot \left(\left(b \cdot b\right) \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{1}{32400}\right)\right)\right) \cdot angle} \]
    10. Applied rewrites89.3%

      \[\leadsto \color{blue}{\left(\left(angle \cdot b\right) \cdot \left(\left(b \cdot \left(\pi \cdot \pi\right)\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)\right) \cdot angle} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification66.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 1.55 \cdot 10^{-28}:\\ \;\;\;\;a \cdot a\\ \mathbf{elif}\;b \leq 1.55 \cdot 10^{+169}:\\ \;\;\;\;\mathsf{fma}\left(angle \cdot angle, \pi \cdot \left(\pi \cdot \left(\left(b \cdot b\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)\right), a \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;angle \cdot \left(\left(angle \cdot b\right) \cdot \left(3.08641975308642 \cdot 10^{-5} \cdot \left(b \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 61.3% accurate, 12.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.05 \cdot 10^{+170}:\\
\;\;\;\;a \cdot a\\

\mathbf{else}:\\
\;\;\;\;angle\_m \cdot \left(\left(angle\_m \cdot b\right) \cdot \left(3.08641975308642 \cdot 10^{-5} \cdot \left(b \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 1.04999999999999999e170

    1. Initial program 78.4%

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

      \[\leadsto \color{blue}{{a}^{2}} \]
    4. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \color{blue}{a \cdot a} \]
      2. lower-*.f6461.1

        \[\leadsto \color{blue}{a \cdot a} \]
    5. Applied rewrites61.1%

      \[\leadsto \color{blue}{a \cdot a} \]

    if 1.04999999999999999e170 < b

    1. Initial program 99.8%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left({angle}^{2}, \frac{-1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right), {a}^{2}\right)} \]
    5. Applied rewrites59.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(angle \cdot angle, \pi \cdot \left(\pi \cdot \mathsf{fma}\left(b \cdot b, 3.08641975308642 \cdot 10^{-5}, \left(a \cdot a\right) \cdot -3.08641975308642 \cdot 10^{-5}\right)\right), a \cdot a\right)} \]
    6. Taylor expanded in b around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(angle \cdot angle\right) \cdot \left(\left(b \cdot b\right) \cdot \left(\left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{1}{32400}\right)\right) \]
      18. lower-PI.f6474.5

        \[\leadsto \left(angle \cdot angle\right) \cdot \left(\left(b \cdot b\right) \cdot \left(\left(\pi \cdot \color{blue}{\pi}\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)\right) \]
    8. Applied rewrites74.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(angle \cdot \left(\left(b \cdot b\right) \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{1}{32400}\right)\right)\right) \cdot angle} \]
    10. Applied rewrites89.3%

      \[\leadsto \color{blue}{\left(\left(angle \cdot b\right) \cdot \left(\left(b \cdot \left(\pi \cdot \pi\right)\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)\right) \cdot angle} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification64.1%

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

Alternative 10: 60.6% accurate, 12.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.16 \cdot 10^{+170}:\\
\;\;\;\;a \cdot a\\

\mathbf{else}:\\
\;\;\;\;b \cdot \left(\left(angle\_m \cdot angle\_m\right) \cdot \left(3.08641975308642 \cdot 10^{-5} \cdot \left(b \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 1.16e170

    1. Initial program 78.4%

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

      \[\leadsto \color{blue}{{a}^{2}} \]
    4. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \color{blue}{a \cdot a} \]
      2. lower-*.f6461.1

        \[\leadsto \color{blue}{a \cdot a} \]
    5. Applied rewrites61.1%

      \[\leadsto \color{blue}{a \cdot a} \]

    if 1.16e170 < b

    1. Initial program 99.8%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left({angle}^{2}, \frac{-1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right), {a}^{2}\right)} \]
    5. Applied rewrites59.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(angle \cdot angle, \pi \cdot \left(\pi \cdot \mathsf{fma}\left(b \cdot b, 3.08641975308642 \cdot 10^{-5}, \left(a \cdot a\right) \cdot -3.08641975308642 \cdot 10^{-5}\right)\right), a \cdot a\right)} \]
    6. Taylor expanded in b around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(angle \cdot angle\right) \cdot \left(\left(b \cdot b\right) \cdot \left(\left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{1}{32400}\right)\right) \]
      18. lower-PI.f6474.5

        \[\leadsto \left(angle \cdot angle\right) \cdot \left(\left(b \cdot b\right) \cdot \left(\left(\pi \cdot \color{blue}{\pi}\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)\right) \]
    8. Applied rewrites74.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto b \cdot \color{blue}{\left(\left(b \cdot \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{1}{32400}\right)\right) \cdot \left(angle \cdot angle\right)\right)} \]
    10. Applied rewrites82.1%

      \[\leadsto \color{blue}{b \cdot \left(\left(\left(b \cdot \left(\pi \cdot \pi\right)\right) \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(angle \cdot angle\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification63.3%

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

Alternative 11: 56.5% accurate, 74.7× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ a \cdot a \end{array} \]
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m) :precision binary64 (* a a))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
	return a * a;
}
angle_m = abs(angle)
real(8) function code(a, b, angle_m)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: angle_m
    code = a * a
end function
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
	return a * a;
}
angle_m = math.fabs(angle)
def code(a, b, angle_m):
	return a * a
angle_m = abs(angle)
function code(a, b, angle_m)
	return Float64(a * a)
end
angle_m = abs(angle);
function tmp = code(a, b, angle_m)
	tmp = a * a;
end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := N[(a * a), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|

\\
a \cdot a
\end{array}
Derivation
  1. Initial program 80.7%

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

    \[\leadsto \color{blue}{{a}^{2}} \]
  4. Step-by-step derivation
    1. unpow2N/A

      \[\leadsto \color{blue}{a \cdot a} \]
    2. lower-*.f6457.0

      \[\leadsto \color{blue}{a \cdot a} \]
  5. Applied rewrites57.0%

    \[\leadsto \color{blue}{a \cdot a} \]
  6. Add Preprocessing

Reproduce

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