ab-angle->ABCF C

Percentage Accurate: 80.3% → 80.3%
Time: 6.2s
Alternatives: 7
Speedup: 2.9×

Specification

?
\[\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} \]
(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}
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}

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 7 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: 80.3% accurate, 1.0× speedup?

\[\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} \]
(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}
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}

Alternative 1: 80.3% accurate, 0.8× speedup?

\[\begin{array}{l} t_0 := \sin \left(\left(0.005555555555555556 \cdot angle\right) \cdot \pi\right) \cdot b\\ {a}^{2} + \frac{{t\_0}^{1}}{{t\_0}^{-1}} \end{array} \]
(FPCore (a b angle)
  :precision binary64
  (let* ((t_0 (* (sin (* (* 0.005555555555555556 angle) PI)) b)))
  (+ (pow a 2.0) (/ (pow t_0 1.0) (pow t_0 -1.0)))))
double code(double a, double b, double angle) {
	double t_0 = sin(((0.005555555555555556 * angle) * ((double) M_PI))) * b;
	return pow(a, 2.0) + (pow(t_0, 1.0) / pow(t_0, -1.0));
}
public static double code(double a, double b, double angle) {
	double t_0 = Math.sin(((0.005555555555555556 * angle) * Math.PI)) * b;
	return Math.pow(a, 2.0) + (Math.pow(t_0, 1.0) / Math.pow(t_0, -1.0));
}
def code(a, b, angle):
	t_0 = math.sin(((0.005555555555555556 * angle) * math.pi)) * b
	return math.pow(a, 2.0) + (math.pow(t_0, 1.0) / math.pow(t_0, -1.0))
function code(a, b, angle)
	t_0 = Float64(sin(Float64(Float64(0.005555555555555556 * angle) * pi)) * b)
	return Float64((a ^ 2.0) + Float64((t_0 ^ 1.0) / (t_0 ^ -1.0)))
end
function tmp = code(a, b, angle)
	t_0 = sin(((0.005555555555555556 * angle) * pi)) * b;
	tmp = (a ^ 2.0) + ((t_0 ^ 1.0) / (t_0 ^ -1.0));
end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[Sin[N[(N[(0.005555555555555556 * angle), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision] * b), $MachinePrecision]}, N[(N[Power[a, 2.0], $MachinePrecision] + N[(N[Power[t$95$0, 1.0], $MachinePrecision] / N[Power[t$95$0, -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := \sin \left(\left(0.005555555555555556 \cdot angle\right) \cdot \pi\right) \cdot b\\
{a}^{2} + \frac{{t\_0}^{1}}{{t\_0}^{-1}}
\end{array}
Derivation
  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. Taylor expanded in angle around 0

    \[\leadsto \color{blue}{{a}^{2}} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
  3. Step-by-step derivation
    1. lower-pow.f6480.3%

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

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

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

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

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

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

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

      \[\leadsto {a}^{2} + {\left(\sin \left(\color{blue}{\frac{angle}{180}} \cdot \pi\right) \cdot b\right)}^{2} \]
    7. mult-flipN/A

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

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

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

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

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

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

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

      \[\leadsto {a}^{2} + {\left(b \cdot \sin \left(\left(\frac{1}{180} \cdot angle\right) \cdot \pi\right)\right)}^{\color{blue}{\left(1 - -1\right)}} \]
    15. pow-subN/A

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

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

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

Alternative 2: 80.3% accurate, 1.4× speedup?

\[{a}^{2} + {\left(\sin \left(\left(0.005555555555555556 \cdot angle\right) \cdot \pi\right) \cdot b\right)}^{2} \]
(FPCore (a b angle)
  :precision binary64
  (+
 (pow a 2.0)
 (pow (* (sin (* (* 0.005555555555555556 angle) PI)) b) 2.0)))
double code(double a, double b, double angle) {
	return pow(a, 2.0) + pow((sin(((0.005555555555555556 * angle) * ((double) M_PI))) * b), 2.0);
}
public static double code(double a, double b, double angle) {
	return Math.pow(a, 2.0) + Math.pow((Math.sin(((0.005555555555555556 * angle) * Math.PI)) * b), 2.0);
}
def code(a, b, angle):
	return math.pow(a, 2.0) + math.pow((math.sin(((0.005555555555555556 * angle) * math.pi)) * b), 2.0)
function code(a, b, angle)
	return Float64((a ^ 2.0) + (Float64(sin(Float64(Float64(0.005555555555555556 * angle) * pi)) * b) ^ 2.0))
end
function tmp = code(a, b, angle)
	tmp = (a ^ 2.0) + ((sin(((0.005555555555555556 * angle) * pi)) * b) ^ 2.0);
end
code[a_, b_, angle_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[Power[N[(N[Sin[N[(N[(0.005555555555555556 * angle), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision] * b), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
{a}^{2} + {\left(\sin \left(\left(0.005555555555555556 \cdot angle\right) \cdot \pi\right) \cdot b\right)}^{2}
Derivation
  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. Taylor expanded in angle around 0

    \[\leadsto \color{blue}{{a}^{2}} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
  3. Step-by-step derivation
    1. lower-pow.f6480.3%

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

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

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

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

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

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

      \[\leadsto {a}^{2} + {\left(\sin \left(\color{blue}{\frac{angle}{180}} \cdot \pi\right) \cdot b\right)}^{2} \]
    6. mult-flipN/A

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

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

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

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

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

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

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

Alternative 3: 80.3% accurate, 2.9× speedup?

\[\begin{array}{l} \mathbf{if}\;\left|angle\right| \leq 3.15 \cdot 10^{-8}:\\ \;\;\;\;{\left(0.005555555555555556 \cdot \left(\left|angle\right| \cdot \left(b \cdot \pi\right)\right)\right)}^{2} + a \cdot a\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(\left(0.005555555555555556 \cdot \left|angle\right|\right) \cdot \pi\right)\right)\right) \cdot \left(b \cdot b\right) + a \cdot a\\ \end{array} \]
(FPCore (a b angle)
  :precision binary64
  (if (<= (fabs angle) 3.15e-8)
  (+
   (pow (* 0.005555555555555556 (* (fabs angle) (* b PI))) 2.0)
   (* a a))
  (+
   (*
    (-
     0.5
     (*
      0.5
      (cos (* 2.0 (* (* 0.005555555555555556 (fabs angle)) PI)))))
    (* b b))
   (* a a))))
double code(double a, double b, double angle) {
	double tmp;
	if (fabs(angle) <= 3.15e-8) {
		tmp = pow((0.005555555555555556 * (fabs(angle) * (b * ((double) M_PI)))), 2.0) + (a * a);
	} else {
		tmp = ((0.5 - (0.5 * cos((2.0 * ((0.005555555555555556 * fabs(angle)) * ((double) M_PI)))))) * (b * b)) + (a * a);
	}
	return tmp;
}
public static double code(double a, double b, double angle) {
	double tmp;
	if (Math.abs(angle) <= 3.15e-8) {
		tmp = Math.pow((0.005555555555555556 * (Math.abs(angle) * (b * Math.PI))), 2.0) + (a * a);
	} else {
		tmp = ((0.5 - (0.5 * Math.cos((2.0 * ((0.005555555555555556 * Math.abs(angle)) * Math.PI))))) * (b * b)) + (a * a);
	}
	return tmp;
}
def code(a, b, angle):
	tmp = 0
	if math.fabs(angle) <= 3.15e-8:
		tmp = math.pow((0.005555555555555556 * (math.fabs(angle) * (b * math.pi))), 2.0) + (a * a)
	else:
		tmp = ((0.5 - (0.5 * math.cos((2.0 * ((0.005555555555555556 * math.fabs(angle)) * math.pi))))) * (b * b)) + (a * a)
	return tmp
function code(a, b, angle)
	tmp = 0.0
	if (abs(angle) <= 3.15e-8)
		tmp = Float64((Float64(0.005555555555555556 * Float64(abs(angle) * Float64(b * pi))) ^ 2.0) + Float64(a * a));
	else
		tmp = Float64(Float64(Float64(0.5 - Float64(0.5 * cos(Float64(2.0 * Float64(Float64(0.005555555555555556 * abs(angle)) * pi))))) * Float64(b * b)) + Float64(a * a));
	end
	return tmp
end
function tmp_2 = code(a, b, angle)
	tmp = 0.0;
	if (abs(angle) <= 3.15e-8)
		tmp = ((0.005555555555555556 * (abs(angle) * (b * pi))) ^ 2.0) + (a * a);
	else
		tmp = ((0.5 - (0.5 * cos((2.0 * ((0.005555555555555556 * abs(angle)) * pi))))) * (b * b)) + (a * a);
	end
	tmp_2 = tmp;
end
code[a_, b_, angle_] := If[LessEqual[N[Abs[angle], $MachinePrecision], 3.15e-8], N[(N[Power[N[(0.005555555555555556 * N[(N[Abs[angle], $MachinePrecision] * N[(b * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(a * a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.5 - N[(0.5 * N[Cos[N[(2.0 * N[(N[(0.005555555555555556 * N[Abs[angle], $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision] + N[(a * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left|angle\right| \leq 3.15 \cdot 10^{-8}:\\
\;\;\;\;{\left(0.005555555555555556 \cdot \left(\left|angle\right| \cdot \left(b \cdot \pi\right)\right)\right)}^{2} + a \cdot a\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if angle < 3.1499999999999998e-8

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

      \[\leadsto \color{blue}{{a}^{2}} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
    3. Step-by-step derivation
      1. lower-pow.f6480.3%

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

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

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

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

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

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

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

        \[\leadsto {a}^{2} + {\left(\sin \left(\color{blue}{\frac{angle}{180}} \cdot \pi\right) \cdot b\right)}^{2} \]
      7. mult-flipN/A

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

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

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

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

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

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

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

        \[\leadsto {a}^{2} + {\left(b \cdot \sin \left(\left(\frac{1}{180} \cdot angle\right) \cdot \pi\right)\right)}^{\color{blue}{\left(1 - -1\right)}} \]
      15. pow-subN/A

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

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

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

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

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

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

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

        \[\leadsto {\left(\frac{1}{180} \cdot \left(angle \cdot \left(b \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right)\right)}^{2} + a \cdot a \]
      4. lower-PI.f6475.5%

        \[\leadsto {\left(0.005555555555555556 \cdot \left(angle \cdot \left(b \cdot \pi\right)\right)\right)}^{2} + a \cdot a \]
    10. Applied rewrites75.5%

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

    if 3.1499999999999998e-8 < angle

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

      \[\leadsto \color{blue}{{a}^{2}} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
    3. Step-by-step derivation
      1. lower-pow.f6480.3%

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

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

      \[\leadsto \color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(\left(0.005555555555555556 \cdot angle\right) \cdot \pi\right)\right)\right) \cdot \left(b \cdot b\right) + a \cdot a} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 4: 80.1% accurate, 2.0× speedup?

\[{\left(b \cdot \sin \left(0.017453292519943295 \cdot angle\right)\right)}^{2} + a \cdot a \]
(FPCore (a b angle)
  :precision binary64
  (+ (pow (* b (sin (* 0.017453292519943295 angle))) 2.0) (* a a)))
double code(double a, double b, double angle) {
	return pow((b * sin((0.017453292519943295 * angle))), 2.0) + (a * a);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(a, b, angle)
use fmin_fmax_functions
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: angle
    code = ((b * sin((0.017453292519943295d0 * angle))) ** 2.0d0) + (a * a)
end function
public static double code(double a, double b, double angle) {
	return Math.pow((b * Math.sin((0.017453292519943295 * angle))), 2.0) + (a * a);
}
def code(a, b, angle):
	return math.pow((b * math.sin((0.017453292519943295 * angle))), 2.0) + (a * a)
function code(a, b, angle)
	return Float64((Float64(b * sin(Float64(0.017453292519943295 * angle))) ^ 2.0) + Float64(a * a))
end
function tmp = code(a, b, angle)
	tmp = ((b * sin((0.017453292519943295 * angle))) ^ 2.0) + (a * a);
end
code[a_, b_, angle_] := N[(N[Power[N[(b * N[Sin[N[(0.017453292519943295 * angle), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(a * a), $MachinePrecision]), $MachinePrecision]
{\left(b \cdot \sin \left(0.017453292519943295 \cdot angle\right)\right)}^{2} + a \cdot a
Derivation
  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. Taylor expanded in angle around 0

    \[\leadsto \color{blue}{{a}^{2}} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
  3. Step-by-step derivation
    1. lower-pow.f6480.3%

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

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

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

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

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

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

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

      \[\leadsto {a}^{2} + {\left(\sin \left(\color{blue}{\frac{angle}{180}} \cdot \pi\right) \cdot b\right)}^{2} \]
    7. mult-flipN/A

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

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

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

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

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

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

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

      \[\leadsto {a}^{2} + {\left(b \cdot \sin \left(\left(\frac{1}{180} \cdot angle\right) \cdot \pi\right)\right)}^{\color{blue}{\left(1 - -1\right)}} \]
    15. pow-subN/A

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

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

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

    \[\leadsto \color{blue}{{\left(b \cdot \sin \left(\left(\pi \cdot 0.005555555555555556\right) \cdot angle\right)\right)}^{2} + a \cdot a} \]
  8. Evaluated real constant80.3%

    \[\leadsto {\left(b \cdot \sin \left(\color{blue}{0.017453292519943295} \cdot angle\right)\right)}^{2} + a \cdot a \]
  9. Add Preprocessing

Alternative 5: 79.9% accurate, 2.9× speedup?

\[\begin{array}{l} \mathbf{if}\;\left|angle\right| \leq 5.5 \cdot 10^{-10}:\\ \;\;\;\;{\left(0.005555555555555556 \cdot \left(\left|angle\right| \cdot \left(b \cdot \pi\right)\right)\right)}^{2} + a \cdot a\\ \mathbf{else}:\\ \;\;\;\;\left(\left(0.5 - 0.5 \cdot \cos \left(0.011111111111111112 \cdot \left(\left|angle\right| \cdot \pi\right)\right)\right) \cdot b\right) \cdot b + \left(1 \cdot a\right) \cdot a\\ \end{array} \]
(FPCore (a b angle)
  :precision binary64
  (if (<= (fabs angle) 5.5e-10)
  (+
   (pow (* 0.005555555555555556 (* (fabs angle) (* b PI))) 2.0)
   (* a a))
  (+
   (*
    (*
     (-
      0.5
      (* 0.5 (cos (* 0.011111111111111112 (* (fabs angle) PI)))))
     b)
    b)
   (* (* 1.0 a) a))))
double code(double a, double b, double angle) {
	double tmp;
	if (fabs(angle) <= 5.5e-10) {
		tmp = pow((0.005555555555555556 * (fabs(angle) * (b * ((double) M_PI)))), 2.0) + (a * a);
	} else {
		tmp = (((0.5 - (0.5 * cos((0.011111111111111112 * (fabs(angle) * ((double) M_PI)))))) * b) * b) + ((1.0 * a) * a);
	}
	return tmp;
}
public static double code(double a, double b, double angle) {
	double tmp;
	if (Math.abs(angle) <= 5.5e-10) {
		tmp = Math.pow((0.005555555555555556 * (Math.abs(angle) * (b * Math.PI))), 2.0) + (a * a);
	} else {
		tmp = (((0.5 - (0.5 * Math.cos((0.011111111111111112 * (Math.abs(angle) * Math.PI))))) * b) * b) + ((1.0 * a) * a);
	}
	return tmp;
}
def code(a, b, angle):
	tmp = 0
	if math.fabs(angle) <= 5.5e-10:
		tmp = math.pow((0.005555555555555556 * (math.fabs(angle) * (b * math.pi))), 2.0) + (a * a)
	else:
		tmp = (((0.5 - (0.5 * math.cos((0.011111111111111112 * (math.fabs(angle) * math.pi))))) * b) * b) + ((1.0 * a) * a)
	return tmp
function code(a, b, angle)
	tmp = 0.0
	if (abs(angle) <= 5.5e-10)
		tmp = Float64((Float64(0.005555555555555556 * Float64(abs(angle) * Float64(b * pi))) ^ 2.0) + Float64(a * a));
	else
		tmp = Float64(Float64(Float64(Float64(0.5 - Float64(0.5 * cos(Float64(0.011111111111111112 * Float64(abs(angle) * pi))))) * b) * b) + Float64(Float64(1.0 * a) * a));
	end
	return tmp
end
function tmp_2 = code(a, b, angle)
	tmp = 0.0;
	if (abs(angle) <= 5.5e-10)
		tmp = ((0.005555555555555556 * (abs(angle) * (b * pi))) ^ 2.0) + (a * a);
	else
		tmp = (((0.5 - (0.5 * cos((0.011111111111111112 * (abs(angle) * pi))))) * b) * b) + ((1.0 * a) * a);
	end
	tmp_2 = tmp;
end
code[a_, b_, angle_] := If[LessEqual[N[Abs[angle], $MachinePrecision], 5.5e-10], N[(N[Power[N[(0.005555555555555556 * N[(N[Abs[angle], $MachinePrecision] * N[(b * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(a * a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(0.5 - N[(0.5 * N[Cos[N[(0.011111111111111112 * N[(N[Abs[angle], $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision] * b), $MachinePrecision] + N[(N[(1.0 * a), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left|angle\right| \leq 5.5 \cdot 10^{-10}:\\
\;\;\;\;{\left(0.005555555555555556 \cdot \left(\left|angle\right| \cdot \left(b \cdot \pi\right)\right)\right)}^{2} + a \cdot a\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if angle < 5.4999999999999996e-10

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

      \[\leadsto \color{blue}{{a}^{2}} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
    3. Step-by-step derivation
      1. lower-pow.f6480.3%

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

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

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

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

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

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

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

        \[\leadsto {a}^{2} + {\left(\sin \left(\color{blue}{\frac{angle}{180}} \cdot \pi\right) \cdot b\right)}^{2} \]
      7. mult-flipN/A

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

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

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

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

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

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

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

        \[\leadsto {a}^{2} + {\left(b \cdot \sin \left(\left(\frac{1}{180} \cdot angle\right) \cdot \pi\right)\right)}^{\color{blue}{\left(1 - -1\right)}} \]
      15. pow-subN/A

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

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

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

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

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

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

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

        \[\leadsto {\left(\frac{1}{180} \cdot \left(angle \cdot \left(b \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right)\right)}^{2} + a \cdot a \]
      4. lower-PI.f6475.5%

        \[\leadsto {\left(0.005555555555555556 \cdot \left(angle \cdot \left(b \cdot \pi\right)\right)\right)}^{2} + a \cdot a \]
    10. Applied rewrites75.5%

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

    if 5.4999999999999996e-10 < angle

    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. Applied rewrites68.9%

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

      \[\leadsto \left(\left(0.5 - \color{blue}{\frac{1}{2}}\right) \cdot b\right) \cdot b + \left(\left(0.5 + 0.5 \cdot \cos \left(\left(angle \cdot \pi\right) \cdot 0.011111111111111112\right)\right) \cdot a\right) \cdot a \]
    4. Step-by-step derivation
      1. Applied rewrites57.5%

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

        \[\leadsto \left(\left(0.5 - 0.5\right) \cdot b\right) \cdot b + \left(\left(0.5 + \color{blue}{\frac{1}{2}}\right) \cdot a\right) \cdot a \]
      3. Step-by-step derivation
        1. Applied rewrites57.7%

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

          \[\leadsto \left(\left(0.5 - 0.5\right) \cdot b\right) \cdot b + \left(\color{blue}{1} \cdot a\right) \cdot a \]
        3. Step-by-step derivation
          1. Applied rewrites57.7%

            \[\leadsto \left(\left(0.5 - 0.5\right) \cdot b\right) \cdot b + \left(\color{blue}{1} \cdot a\right) \cdot a \]
          2. Taylor expanded in angle around inf

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

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

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

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

              \[\leadsto \left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \cdot b\right) \cdot b + \left(1 \cdot a\right) \cdot a \]
            5. lower-PI.f6468.9%

              \[\leadsto \left(\left(0.5 - 0.5 \cdot \cos \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right)\right) \cdot b\right) \cdot b + \left(1 \cdot a\right) \cdot a \]
          4. Applied rewrites68.9%

            \[\leadsto \left(\left(0.5 - \color{blue}{0.5 \cdot \cos \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right)}\right) \cdot b\right) \cdot b + \left(1 \cdot a\right) \cdot a \]
        4. Recombined 2 regimes into one program.
        5. Add Preprocessing

        Alternative 6: 77.9% accurate, 3.3× speedup?

        \[\begin{array}{l} \mathbf{if}\;\left|b\right| \leq 4.2 \cdot 10^{-97}:\\ \;\;\;\;\left(\left(0.5 - 0.5\right) \cdot \left|b\right|\right) \cdot \left|b\right| + \left(1 \cdot a\right) \cdot a\\ \mathbf{else}:\\ \;\;\;\;{\left(0.005555555555555556 \cdot \left(angle \cdot \left(\left|b\right| \cdot \pi\right)\right)\right)}^{2} + a \cdot a\\ \end{array} \]
        (FPCore (a b angle)
          :precision binary64
          (if (<= (fabs b) 4.2e-97)
          (+ (* (* (- 0.5 0.5) (fabs b)) (fabs b)) (* (* 1.0 a) a))
          (+
           (pow (* 0.005555555555555556 (* angle (* (fabs b) PI))) 2.0)
           (* a a))))
        double code(double a, double b, double angle) {
        	double tmp;
        	if (fabs(b) <= 4.2e-97) {
        		tmp = (((0.5 - 0.5) * fabs(b)) * fabs(b)) + ((1.0 * a) * a);
        	} else {
        		tmp = pow((0.005555555555555556 * (angle * (fabs(b) * ((double) M_PI)))), 2.0) + (a * a);
        	}
        	return tmp;
        }
        
        public static double code(double a, double b, double angle) {
        	double tmp;
        	if (Math.abs(b) <= 4.2e-97) {
        		tmp = (((0.5 - 0.5) * Math.abs(b)) * Math.abs(b)) + ((1.0 * a) * a);
        	} else {
        		tmp = Math.pow((0.005555555555555556 * (angle * (Math.abs(b) * Math.PI))), 2.0) + (a * a);
        	}
        	return tmp;
        }
        
        def code(a, b, angle):
        	tmp = 0
        	if math.fabs(b) <= 4.2e-97:
        		tmp = (((0.5 - 0.5) * math.fabs(b)) * math.fabs(b)) + ((1.0 * a) * a)
        	else:
        		tmp = math.pow((0.005555555555555556 * (angle * (math.fabs(b) * math.pi))), 2.0) + (a * a)
        	return tmp
        
        function code(a, b, angle)
        	tmp = 0.0
        	if (abs(b) <= 4.2e-97)
        		tmp = Float64(Float64(Float64(Float64(0.5 - 0.5) * abs(b)) * abs(b)) + Float64(Float64(1.0 * a) * a));
        	else
        		tmp = Float64((Float64(0.005555555555555556 * Float64(angle * Float64(abs(b) * pi))) ^ 2.0) + Float64(a * a));
        	end
        	return tmp
        end
        
        function tmp_2 = code(a, b, angle)
        	tmp = 0.0;
        	if (abs(b) <= 4.2e-97)
        		tmp = (((0.5 - 0.5) * abs(b)) * abs(b)) + ((1.0 * a) * a);
        	else
        		tmp = ((0.005555555555555556 * (angle * (abs(b) * pi))) ^ 2.0) + (a * a);
        	end
        	tmp_2 = tmp;
        end
        
        code[a_, b_, angle_] := If[LessEqual[N[Abs[b], $MachinePrecision], 4.2e-97], N[(N[(N[(N[(0.5 - 0.5), $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 * a), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(0.005555555555555556 * N[(angle * N[(N[Abs[b], $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(a * a), $MachinePrecision]), $MachinePrecision]]
        
        \begin{array}{l}
        \mathbf{if}\;\left|b\right| \leq 4.2 \cdot 10^{-97}:\\
        \;\;\;\;\left(\left(0.5 - 0.5\right) \cdot \left|b\right|\right) \cdot \left|b\right| + \left(1 \cdot a\right) \cdot a\\
        
        \mathbf{else}:\\
        \;\;\;\;{\left(0.005555555555555556 \cdot \left(angle \cdot \left(\left|b\right| \cdot \pi\right)\right)\right)}^{2} + a \cdot a\\
        
        
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if b < 4.2000000000000002e-97

          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. Applied rewrites68.9%

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

            \[\leadsto \left(\left(0.5 - \color{blue}{\frac{1}{2}}\right) \cdot b\right) \cdot b + \left(\left(0.5 + 0.5 \cdot \cos \left(\left(angle \cdot \pi\right) \cdot 0.011111111111111112\right)\right) \cdot a\right) \cdot a \]
          4. Step-by-step derivation
            1. Applied rewrites57.5%

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

              \[\leadsto \left(\left(0.5 - 0.5\right) \cdot b\right) \cdot b + \left(\left(0.5 + \color{blue}{\frac{1}{2}}\right) \cdot a\right) \cdot a \]
            3. Step-by-step derivation
              1. Applied rewrites57.7%

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

                \[\leadsto \left(\left(0.5 - 0.5\right) \cdot b\right) \cdot b + \left(\color{blue}{1} \cdot a\right) \cdot a \]
              3. Step-by-step derivation
                1. Applied rewrites57.7%

                  \[\leadsto \left(\left(0.5 - 0.5\right) \cdot b\right) \cdot b + \left(\color{blue}{1} \cdot a\right) \cdot a \]

                if 4.2000000000000002e-97 < b

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

                  \[\leadsto \color{blue}{{a}^{2}} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
                3. Step-by-step derivation
                  1. lower-pow.f6480.3%

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

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

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

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

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

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

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

                    \[\leadsto {a}^{2} + {\left(\sin \left(\color{blue}{\frac{angle}{180}} \cdot \pi\right) \cdot b\right)}^{2} \]
                  7. mult-flipN/A

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

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

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

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

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

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

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

                    \[\leadsto {a}^{2} + {\left(b \cdot \sin \left(\left(\frac{1}{180} \cdot angle\right) \cdot \pi\right)\right)}^{\color{blue}{\left(1 - -1\right)}} \]
                  15. pow-subN/A

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

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

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

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

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

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

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

                    \[\leadsto {\left(\frac{1}{180} \cdot \left(angle \cdot \left(b \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right)\right)}^{2} + a \cdot a \]
                  4. lower-PI.f6475.5%

                    \[\leadsto {\left(0.005555555555555556 \cdot \left(angle \cdot \left(b \cdot \pi\right)\right)\right)}^{2} + a \cdot a \]
                10. Applied rewrites75.5%

                  \[\leadsto {\color{blue}{\left(0.005555555555555556 \cdot \left(angle \cdot \left(b \cdot \pi\right)\right)\right)}}^{2} + a \cdot a \]
              4. Recombined 2 regimes into one program.
              5. Add Preprocessing

              Alternative 7: 57.7% accurate, 16.6× speedup?

              \[\left(\left(0.5 - 0.5\right) \cdot b\right) \cdot b + \left(1 \cdot a\right) \cdot a \]
              (FPCore (a b angle)
                :precision binary64
                (+ (* (* (- 0.5 0.5) b) b) (* (* 1.0 a) a)))
              double code(double a, double b, double angle) {
              	return (((0.5 - 0.5) * b) * b) + ((1.0 * a) * a);
              }
              
              module fmin_fmax_functions
                  implicit none
                  private
                  public fmax
                  public fmin
              
                  interface fmax
                      module procedure fmax88
                      module procedure fmax44
                      module procedure fmax84
                      module procedure fmax48
                  end interface
                  interface fmin
                      module procedure fmin88
                      module procedure fmin44
                      module procedure fmin84
                      module procedure fmin48
                  end interface
              contains
                  real(8) function fmax88(x, y) result (res)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                  end function
                  real(4) function fmax44(x, y) result (res)
                      real(4), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                  end function
                  real(8) function fmax84(x, y) result(res)
                      real(8), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                  end function
                  real(8) function fmax48(x, y) result(res)
                      real(4), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                  end function
                  real(8) function fmin88(x, y) result (res)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                  end function
                  real(4) function fmin44(x, y) result (res)
                      real(4), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                  end function
                  real(8) function fmin84(x, y) result(res)
                      real(8), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                  end function
                  real(8) function fmin48(x, y) result(res)
                      real(4), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                  end function
              end module
              
              real(8) function code(a, b, angle)
              use fmin_fmax_functions
                  real(8), intent (in) :: a
                  real(8), intent (in) :: b
                  real(8), intent (in) :: angle
                  code = (((0.5d0 - 0.5d0) * b) * b) + ((1.0d0 * a) * a)
              end function
              
              public static double code(double a, double b, double angle) {
              	return (((0.5 - 0.5) * b) * b) + ((1.0 * a) * a);
              }
              
              def code(a, b, angle):
              	return (((0.5 - 0.5) * b) * b) + ((1.0 * a) * a)
              
              function code(a, b, angle)
              	return Float64(Float64(Float64(Float64(0.5 - 0.5) * b) * b) + Float64(Float64(1.0 * a) * a))
              end
              
              function tmp = code(a, b, angle)
              	tmp = (((0.5 - 0.5) * b) * b) + ((1.0 * a) * a);
              end
              
              code[a_, b_, angle_] := N[(N[(N[(N[(0.5 - 0.5), $MachinePrecision] * b), $MachinePrecision] * b), $MachinePrecision] + N[(N[(1.0 * a), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]
              
              \left(\left(0.5 - 0.5\right) \cdot b\right) \cdot b + \left(1 \cdot a\right) \cdot a
              
              Derivation
              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. Applied rewrites68.9%

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

                \[\leadsto \left(\left(0.5 - \color{blue}{\frac{1}{2}}\right) \cdot b\right) \cdot b + \left(\left(0.5 + 0.5 \cdot \cos \left(\left(angle \cdot \pi\right) \cdot 0.011111111111111112\right)\right) \cdot a\right) \cdot a \]
              4. Step-by-step derivation
                1. Applied rewrites57.5%

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

                  \[\leadsto \left(\left(0.5 - 0.5\right) \cdot b\right) \cdot b + \left(\left(0.5 + \color{blue}{\frac{1}{2}}\right) \cdot a\right) \cdot a \]
                3. Step-by-step derivation
                  1. Applied rewrites57.7%

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

                    \[\leadsto \left(\left(0.5 - 0.5\right) \cdot b\right) \cdot b + \left(\color{blue}{1} \cdot a\right) \cdot a \]
                  3. Step-by-step derivation
                    1. Applied rewrites57.7%

                      \[\leadsto \left(\left(0.5 - 0.5\right) \cdot b\right) \cdot b + \left(\color{blue}{1} \cdot a\right) \cdot a \]
                    2. Add Preprocessing

                    Reproduce

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