ab-angle->ABCF A

Percentage Accurate: 79.6% → 79.5%
Time: 13.7s
Alternatives: 13
Speedup: N/A×

Specification

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

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

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

Initial Program: 79.6% accurate, 1.0× speedup?

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

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

Alternative 1: 79.5% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 2: 76.9% accurate, 1.8× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{angle}{180} \leq 5 \cdot 10^{+14}:\\ \;\;\;\;{\left(1 \cdot b\right)}^{2} + {\left(\left(\left(\pi \cdot 0.005555555555555556\right) \cdot angle\right) \cdot a\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{1}{\mathsf{fma}\left(\left(1 \cdot b\right) \cdot 1, b, \left(a \cdot a\right) \cdot \left(0.5 - \cos \left(\left(\left(angle \cdot \pi\right) \cdot 0.005555555555555556\right) \cdot 2\right) \cdot 0.5\right)\right)}}\\ \end{array} \end{array} \]
    (FPCore (a b angle)
     :precision binary64
     (if (<= (/ angle 180.0) 5e+14)
       (+
        (pow (* 1.0 b) 2.0)
        (pow (* (* (* PI 0.005555555555555556) angle) a) 2.0))
       (/
        1.0
        (/
         1.0
         (fma
          (* (* 1.0 b) 1.0)
          b
          (*
           (* a a)
           (-
            0.5
            (* (cos (* (* (* angle PI) 0.005555555555555556) 2.0)) 0.5))))))))
    double code(double a, double b, double angle) {
    	double tmp;
    	if ((angle / 180.0) <= 5e+14) {
    		tmp = pow((1.0 * b), 2.0) + pow((((((double) M_PI) * 0.005555555555555556) * angle) * a), 2.0);
    	} else {
    		tmp = 1.0 / (1.0 / fma(((1.0 * b) * 1.0), b, ((a * a) * (0.5 - (cos((((angle * ((double) M_PI)) * 0.005555555555555556) * 2.0)) * 0.5)))));
    	}
    	return tmp;
    }
    
    function code(a, b, angle)
    	tmp = 0.0
    	if (Float64(angle / 180.0) <= 5e+14)
    		tmp = Float64((Float64(1.0 * b) ^ 2.0) + (Float64(Float64(Float64(pi * 0.005555555555555556) * angle) * a) ^ 2.0));
    	else
    		tmp = Float64(1.0 / Float64(1.0 / fma(Float64(Float64(1.0 * b) * 1.0), b, Float64(Float64(a * a) * Float64(0.5 - Float64(cos(Float64(Float64(Float64(angle * pi) * 0.005555555555555556) * 2.0)) * 0.5))))));
    	end
    	return tmp
    end
    
    code[a_, b_, angle_] := If[LessEqual[N[(angle / 180.0), $MachinePrecision], 5e+14], N[(N[Power[N[(1.0 * b), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(N[(N[(Pi * 0.005555555555555556), $MachinePrecision] * angle), $MachinePrecision] * a), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(1.0 / N[(N[(N[(1.0 * b), $MachinePrecision] * 1.0), $MachinePrecision] * b + N[(N[(a * a), $MachinePrecision] * N[(0.5 - N[(N[Cos[N[(N[(N[(angle * Pi), $MachinePrecision] * 0.005555555555555556), $MachinePrecision] * 2.0), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;\frac{angle}{180} \leq 5 \cdot 10^{+14}:\\
    \;\;\;\;{\left(1 \cdot b\right)}^{2} + {\left(\left(\left(\pi \cdot 0.005555555555555556\right) \cdot angle\right) \cdot a\right)}^{2}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{1}{\frac{1}{\mathsf{fma}\left(\left(1 \cdot b\right) \cdot 1, b, \left(a \cdot a\right) \cdot \left(0.5 - \cos \left(\left(\left(angle \cdot \pi\right) \cdot 0.005555555555555556\right) \cdot 2\right) \cdot 0.5\right)\right)}}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (/.f64 angle #s(literal 180 binary64)) < 5e14

      1. Initial program 85.5%

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

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

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

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

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

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

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

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

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

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

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

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

        1. Initial program 64.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \color{blue}{\frac{1}{\frac{{\left(a \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)\right)}^{2} - {\left(b \cdot 1\right)}^{2}}{{\left(a \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)\right)}^{2} \cdot {\left(a \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)\right)}^{2} - {\left(b \cdot 1\right)}^{2} \cdot {\left(b \cdot 1\right)}^{2}}}} \]
          5. Applied rewrites64.0%

            \[\leadsto \color{blue}{\frac{1}{\frac{1}{\mathsf{fma}\left(\left(1 \cdot b\right) \cdot 1, b, \left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)\right)\right) \cdot \left(a \cdot a\right)\right)}}} \]
        5. Recombined 2 regimes into one program.
        6. Final simplification77.7%

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

        Alternative 3: 79.5% accurate, 1.9× speedup?

        \[\begin{array}{l} \\ {\left(\sin \left(\frac{angle}{180} \cdot \pi\right) \cdot a\right)}^{2} + b \cdot b \end{array} \]
        (FPCore (a b angle)
         :precision binary64
         (+ (pow (* (sin (* (/ angle 180.0) PI)) a) 2.0) (* b b)))
        double code(double a, double b, double angle) {
        	return pow((sin(((angle / 180.0) * ((double) M_PI))) * a), 2.0) + (b * b);
        }
        
        public static double code(double a, double b, double angle) {
        	return Math.pow((Math.sin(((angle / 180.0) * Math.PI)) * a), 2.0) + (b * b);
        }
        
        def code(a, b, angle):
        	return math.pow((math.sin(((angle / 180.0) * math.pi)) * a), 2.0) + (b * b)
        
        function code(a, b, angle)
        	return Float64((Float64(sin(Float64(Float64(angle / 180.0) * pi)) * a) ^ 2.0) + Float64(b * b))
        end
        
        function tmp = code(a, b, angle)
        	tmp = ((sin(((angle / 180.0) * pi)) * a) ^ 2.0) + (b * b);
        end
        
        code[a_, b_, angle_] := N[(N[Power[N[(N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision] * a), $MachinePrecision], 2.0], $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]
        
        \begin{array}{l}
        
        \\
        {\left(\sin \left(\frac{angle}{180} \cdot \pi\right) \cdot a\right)}^{2} + b \cdot b
        \end{array}
        
        Derivation
        1. Initial program 80.0%

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

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

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

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

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

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

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

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

          Alternative 4: 76.3% accurate, 2.4× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{angle}{180} \leq 5 \cdot 10^{+14}:\\ \;\;\;\;\mathsf{fma}\left(\left(\pi \cdot \pi\right) \cdot \left(\left(\left(angle \cdot a\right) \cdot angle\right) \cdot 3.08641975308642 \cdot 10^{-5}\right), a, \left(\left(\cos \left(\left(\left(angle \cdot 0.005555555555555556\right) \cdot \pi\right) \cdot 2\right) \cdot 0.5 + 0.5\right) \cdot b\right) \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{1}{\mathsf{fma}\left(\left(1 \cdot b\right) \cdot 1, b, \left(a \cdot a\right) \cdot \left(0.5 - \cos \left(\left(\left(angle \cdot \pi\right) \cdot 0.005555555555555556\right) \cdot 2\right) \cdot 0.5\right)\right)}}\\ \end{array} \end{array} \]
          (FPCore (a b angle)
           :precision binary64
           (if (<= (/ angle 180.0) 5e+14)
             (fma
              (* (* PI PI) (* (* (* angle a) angle) 3.08641975308642e-5))
              a
              (*
               (* (+ (* (cos (* (* (* angle 0.005555555555555556) PI) 2.0)) 0.5) 0.5) b)
               b))
             (/
              1.0
              (/
               1.0
               (fma
                (* (* 1.0 b) 1.0)
                b
                (*
                 (* a a)
                 (-
                  0.5
                  (* (cos (* (* (* angle PI) 0.005555555555555556) 2.0)) 0.5))))))))
          double code(double a, double b, double angle) {
          	double tmp;
          	if ((angle / 180.0) <= 5e+14) {
          		tmp = fma(((((double) M_PI) * ((double) M_PI)) * (((angle * a) * angle) * 3.08641975308642e-5)), a, ((((cos((((angle * 0.005555555555555556) * ((double) M_PI)) * 2.0)) * 0.5) + 0.5) * b) * b));
          	} else {
          		tmp = 1.0 / (1.0 / fma(((1.0 * b) * 1.0), b, ((a * a) * (0.5 - (cos((((angle * ((double) M_PI)) * 0.005555555555555556) * 2.0)) * 0.5)))));
          	}
          	return tmp;
          }
          
          function code(a, b, angle)
          	tmp = 0.0
          	if (Float64(angle / 180.0) <= 5e+14)
          		tmp = fma(Float64(Float64(pi * pi) * Float64(Float64(Float64(angle * a) * angle) * 3.08641975308642e-5)), a, Float64(Float64(Float64(Float64(cos(Float64(Float64(Float64(angle * 0.005555555555555556) * pi) * 2.0)) * 0.5) + 0.5) * b) * b));
          	else
          		tmp = Float64(1.0 / Float64(1.0 / fma(Float64(Float64(1.0 * b) * 1.0), b, Float64(Float64(a * a) * Float64(0.5 - Float64(cos(Float64(Float64(Float64(angle * pi) * 0.005555555555555556) * 2.0)) * 0.5))))));
          	end
          	return tmp
          end
          
          code[a_, b_, angle_] := If[LessEqual[N[(angle / 180.0), $MachinePrecision], 5e+14], N[(N[(N[(Pi * Pi), $MachinePrecision] * N[(N[(N[(angle * a), $MachinePrecision] * angle), $MachinePrecision] * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision] * a + N[(N[(N[(N[(N[Cos[N[(N[(N[(angle * 0.005555555555555556), $MachinePrecision] * Pi), $MachinePrecision] * 2.0), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision] + 0.5), $MachinePrecision] * b), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(1.0 / N[(N[(N[(1.0 * b), $MachinePrecision] * 1.0), $MachinePrecision] * b + N[(N[(a * a), $MachinePrecision] * N[(0.5 - N[(N[Cos[N[(N[(N[(angle * Pi), $MachinePrecision] * 0.005555555555555556), $MachinePrecision] * 2.0), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;\frac{angle}{180} \leq 5 \cdot 10^{+14}:\\
          \;\;\;\;\mathsf{fma}\left(\left(\pi \cdot \pi\right) \cdot \left(\left(\left(angle \cdot a\right) \cdot angle\right) \cdot 3.08641975308642 \cdot 10^{-5}\right), a, \left(\left(\cos \left(\left(\left(angle \cdot 0.005555555555555556\right) \cdot \pi\right) \cdot 2\right) \cdot 0.5 + 0.5\right) \cdot b\right) \cdot b\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{1}{\frac{1}{\mathsf{fma}\left(\left(1 \cdot b\right) \cdot 1, b, \left(a \cdot a\right) \cdot \left(0.5 - \cos \left(\left(\left(angle \cdot \pi\right) \cdot 0.005555555555555556\right) \cdot 2\right) \cdot 0.5\right)\right)}}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if (/.f64 angle #s(literal 180 binary64)) < 5e14

            1. Initial program 85.5%

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

              \[\leadsto \color{blue}{\mathsf{fma}\left(e^{\log \left(\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)\right) \cdot a\right)}, a, \left(\left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)\right) \cdot b\right) \cdot b\right)} \]
            4. Taylor expanded in angle around 0

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \mathsf{fma}\left(\left(\frac{1}{32400} \cdot \left(\left(a \cdot angle\right) \cdot angle\right)\right) \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right), a, \left(\left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\frac{1}{180} \cdot angle\right)\right)\right)\right) \cdot b\right) \cdot b\right) \]
              12. lower-PI.f6480.5

                \[\leadsto \mathsf{fma}\left(\left(3.08641975308642 \cdot 10^{-5} \cdot \left(\left(a \cdot angle\right) \cdot angle\right)\right) \cdot \left(\pi \cdot \color{blue}{\pi}\right), a, \left(\left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)\right) \cdot b\right) \cdot b\right) \]
            6. Applied rewrites80.5%

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

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

            1. Initial program 64.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \color{blue}{\frac{1}{\frac{{\left(a \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)\right)}^{2} - {\left(b \cdot 1\right)}^{2}}{{\left(a \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)\right)}^{2} \cdot {\left(a \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)\right)}^{2} - {\left(b \cdot 1\right)}^{2} \cdot {\left(b \cdot 1\right)}^{2}}}} \]
              5. Applied rewrites64.0%

                \[\leadsto \color{blue}{\frac{1}{\frac{1}{\mathsf{fma}\left(\left(1 \cdot b\right) \cdot 1, b, \left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)\right)\right) \cdot \left(a \cdot a\right)\right)}}} \]
            5. Recombined 2 regimes into one program.
            6. Final simplification76.3%

              \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{angle}{180} \leq 5 \cdot 10^{+14}:\\ \;\;\;\;\mathsf{fma}\left(\left(\pi \cdot \pi\right) \cdot \left(\left(\left(angle \cdot a\right) \cdot angle\right) \cdot 3.08641975308642 \cdot 10^{-5}\right), a, \left(\left(\cos \left(\left(\left(angle \cdot 0.005555555555555556\right) \cdot \pi\right) \cdot 2\right) \cdot 0.5 + 0.5\right) \cdot b\right) \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{1}{\mathsf{fma}\left(\left(1 \cdot b\right) \cdot 1, b, \left(a \cdot a\right) \cdot \left(0.5 - \cos \left(\left(\left(angle \cdot \pi\right) \cdot 0.005555555555555556\right) \cdot 2\right) \cdot 0.5\right)\right)}}\\ \end{array} \]
            7. Add Preprocessing

            Alternative 5: 76.3% accurate, 2.5× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{angle}{180} \leq 5 \cdot 10^{+14}:\\ \;\;\;\;\mathsf{fma}\left(\left(\pi \cdot \pi\right) \cdot \left(\left(\left(angle \cdot a\right) \cdot angle\right) \cdot 3.08641975308642 \cdot 10^{-5}\right), a, \left(\left(\cos \left(\left(\left(angle \cdot 0.005555555555555556\right) \cdot \pi\right) \cdot 2\right) \cdot 0.5 + 0.5\right) \cdot b\right) \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.5, \cos \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right), 0.5\right) \cdot a, a, \left(1 \cdot b\right) \cdot b\right)\\ \end{array} \end{array} \]
            (FPCore (a b angle)
             :precision binary64
             (if (<= (/ angle 180.0) 5e+14)
               (fma
                (* (* PI PI) (* (* (* angle a) angle) 3.08641975308642e-5))
                a
                (*
                 (* (+ (* (cos (* (* (* angle 0.005555555555555556) PI) 2.0)) 0.5) 0.5) b)
                 b))
               (fma
                (* (fma -0.5 (cos (* 0.011111111111111112 (* angle PI))) 0.5) a)
                a
                (* (* 1.0 b) b))))
            double code(double a, double b, double angle) {
            	double tmp;
            	if ((angle / 180.0) <= 5e+14) {
            		tmp = fma(((((double) M_PI) * ((double) M_PI)) * (((angle * a) * angle) * 3.08641975308642e-5)), a, ((((cos((((angle * 0.005555555555555556) * ((double) M_PI)) * 2.0)) * 0.5) + 0.5) * b) * b));
            	} else {
            		tmp = fma((fma(-0.5, cos((0.011111111111111112 * (angle * ((double) M_PI)))), 0.5) * a), a, ((1.0 * b) * b));
            	}
            	return tmp;
            }
            
            function code(a, b, angle)
            	tmp = 0.0
            	if (Float64(angle / 180.0) <= 5e+14)
            		tmp = fma(Float64(Float64(pi * pi) * Float64(Float64(Float64(angle * a) * angle) * 3.08641975308642e-5)), a, Float64(Float64(Float64(Float64(cos(Float64(Float64(Float64(angle * 0.005555555555555556) * pi) * 2.0)) * 0.5) + 0.5) * b) * b));
            	else
            		tmp = fma(Float64(fma(-0.5, cos(Float64(0.011111111111111112 * Float64(angle * pi))), 0.5) * a), a, Float64(Float64(1.0 * b) * b));
            	end
            	return tmp
            end
            
            code[a_, b_, angle_] := If[LessEqual[N[(angle / 180.0), $MachinePrecision], 5e+14], N[(N[(N[(Pi * Pi), $MachinePrecision] * N[(N[(N[(angle * a), $MachinePrecision] * angle), $MachinePrecision] * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision] * a + N[(N[(N[(N[(N[Cos[N[(N[(N[(angle * 0.005555555555555556), $MachinePrecision] * Pi), $MachinePrecision] * 2.0), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision] + 0.5), $MachinePrecision] * b), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-0.5 * N[Cos[N[(0.011111111111111112 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision] * a), $MachinePrecision] * a + N[(N[(1.0 * b), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;\frac{angle}{180} \leq 5 \cdot 10^{+14}:\\
            \;\;\;\;\mathsf{fma}\left(\left(\pi \cdot \pi\right) \cdot \left(\left(\left(angle \cdot a\right) \cdot angle\right) \cdot 3.08641975308642 \cdot 10^{-5}\right), a, \left(\left(\cos \left(\left(\left(angle \cdot 0.005555555555555556\right) \cdot \pi\right) \cdot 2\right) \cdot 0.5 + 0.5\right) \cdot b\right) \cdot b\right)\\
            
            \mathbf{else}:\\
            \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.5, \cos \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right), 0.5\right) \cdot a, a, \left(1 \cdot b\right) \cdot b\right)\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if (/.f64 angle #s(literal 180 binary64)) < 5e14

              1. Initial program 85.5%

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

                \[\leadsto \color{blue}{\mathsf{fma}\left(e^{\log \left(\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)\right) \cdot a\right)}, a, \left(\left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)\right) \cdot b\right) \cdot b\right)} \]
              4. Taylor expanded in angle around 0

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \mathsf{fma}\left(\left(\frac{1}{32400} \cdot \left(\left(a \cdot angle\right) \cdot angle\right)\right) \cdot \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right), a, \left(\left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\frac{1}{180} \cdot angle\right)\right)\right)\right) \cdot b\right) \cdot b\right) \]
                12. lower-PI.f6480.5

                  \[\leadsto \mathsf{fma}\left(\left(3.08641975308642 \cdot 10^{-5} \cdot \left(\left(a \cdot angle\right) \cdot angle\right)\right) \cdot \left(\pi \cdot \color{blue}{\pi}\right), a, \left(\left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)\right) \cdot b\right) \cdot b\right) \]
              6. Applied rewrites80.5%

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

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

              1. Initial program 64.0%

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

                \[\leadsto \color{blue}{\mathsf{fma}\left(e^{\log \left(\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)\right) \cdot a\right)}, a, \left(\left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)\right) \cdot b\right) \cdot b\right)} \]
              4. Step-by-step derivation
                1. lift-exp.f64N/A

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

                  \[\leadsto \mathsf{fma}\left(e^{\color{blue}{\log \left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\frac{1}{180} \cdot angle\right)\right)\right)\right) \cdot a\right)}}, a, \left(\left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\frac{1}{180} \cdot angle\right)\right)\right)\right) \cdot b\right) \cdot b\right) \]
                3. rem-exp-log64.0

                  \[\leadsto \mathsf{fma}\left(\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)\right) \cdot a}, a, \left(\left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)\right) \cdot b\right) \cdot b\right) \]
              5. Applied rewrites63.9%

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

                \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{2}, \cos \left(\frac{1}{90} \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right), \frac{1}{2}\right) \cdot a, a, \left(\color{blue}{1} \cdot b\right) \cdot b\right) \]
              7. Step-by-step derivation
                1. Applied rewrites64.0%

                  \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-0.5, \cos \left(0.011111111111111112 \cdot \left(\pi \cdot angle\right)\right), 0.5\right) \cdot a, a, \left(\color{blue}{1} \cdot b\right) \cdot b\right) \]
              8. Recombined 2 regimes into one program.
              9. Final simplification76.3%

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

              Alternative 6: 69.6% accurate, 2.9× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq 5.6 \cdot 10^{-15}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.5, \cos \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right), 0.5\right) \cdot a, a, \left(1 \cdot b\right) \cdot b\right)\\ \mathbf{elif}\;a \leq 5 \cdot 10^{+139}:\\ \;\;\;\;\left(\left(\left(a \cdot a\right) \cdot \pi\right) \cdot \pi\right) \cdot \left(\left(angle \cdot angle\right) \cdot 3.08641975308642 \cdot 10^{-5}\right) + {\left(1 \cdot b\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\left(3.08641975308642 \cdot 10^{-5} \cdot a\right) \cdot angle\right) \cdot \left(angle \cdot a\right)\right) \cdot \left(\pi \cdot \pi\right)\\ \end{array} \end{array} \]
              (FPCore (a b angle)
               :precision binary64
               (if (<= a 5.6e-15)
                 (fma
                  (* (fma -0.5 (cos (* 0.011111111111111112 (* angle PI))) 0.5) a)
                  a
                  (* (* 1.0 b) b))
                 (if (<= a 5e+139)
                   (+
                    (* (* (* (* a a) PI) PI) (* (* angle angle) 3.08641975308642e-5))
                    (pow (* 1.0 b) 2.0))
                   (* (* (* (* 3.08641975308642e-5 a) angle) (* angle a)) (* PI PI)))))
              double code(double a, double b, double angle) {
              	double tmp;
              	if (a <= 5.6e-15) {
              		tmp = fma((fma(-0.5, cos((0.011111111111111112 * (angle * ((double) M_PI)))), 0.5) * a), a, ((1.0 * b) * b));
              	} else if (a <= 5e+139) {
              		tmp = ((((a * a) * ((double) M_PI)) * ((double) M_PI)) * ((angle * angle) * 3.08641975308642e-5)) + pow((1.0 * b), 2.0);
              	} else {
              		tmp = (((3.08641975308642e-5 * a) * angle) * (angle * a)) * (((double) M_PI) * ((double) M_PI));
              	}
              	return tmp;
              }
              
              function code(a, b, angle)
              	tmp = 0.0
              	if (a <= 5.6e-15)
              		tmp = fma(Float64(fma(-0.5, cos(Float64(0.011111111111111112 * Float64(angle * pi))), 0.5) * a), a, Float64(Float64(1.0 * b) * b));
              	elseif (a <= 5e+139)
              		tmp = Float64(Float64(Float64(Float64(Float64(a * a) * pi) * pi) * Float64(Float64(angle * angle) * 3.08641975308642e-5)) + (Float64(1.0 * b) ^ 2.0));
              	else
              		tmp = Float64(Float64(Float64(Float64(3.08641975308642e-5 * a) * angle) * Float64(angle * a)) * Float64(pi * pi));
              	end
              	return tmp
              end
              
              code[a_, b_, angle_] := If[LessEqual[a, 5.6e-15], N[(N[(N[(-0.5 * N[Cos[N[(0.011111111111111112 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision] * a), $MachinePrecision] * a + N[(N[(1.0 * b), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 5e+139], N[(N[(N[(N[(N[(a * a), $MachinePrecision] * Pi), $MachinePrecision] * Pi), $MachinePrecision] * N[(N[(angle * angle), $MachinePrecision] * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision] + N[Power[N[(1.0 * b), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(3.08641975308642e-5 * a), $MachinePrecision] * angle), $MachinePrecision] * N[(angle * a), $MachinePrecision]), $MachinePrecision] * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;a \leq 5.6 \cdot 10^{-15}:\\
              \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.5, \cos \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right), 0.5\right) \cdot a, a, \left(1 \cdot b\right) \cdot b\right)\\
              
              \mathbf{elif}\;a \leq 5 \cdot 10^{+139}:\\
              \;\;\;\;\left(\left(\left(a \cdot a\right) \cdot \pi\right) \cdot \pi\right) \cdot \left(\left(angle \cdot angle\right) \cdot 3.08641975308642 \cdot 10^{-5}\right) + {\left(1 \cdot b\right)}^{2}\\
              
              \mathbf{else}:\\
              \;\;\;\;\left(\left(\left(3.08641975308642 \cdot 10^{-5} \cdot a\right) \cdot angle\right) \cdot \left(angle \cdot a\right)\right) \cdot \left(\pi \cdot \pi\right)\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 3 regimes
              2. if a < 5.60000000000000028e-15

                1. Initial program 78.3%

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

                  \[\leadsto \color{blue}{\mathsf{fma}\left(e^{\log \left(\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)\right) \cdot a\right)}, a, \left(\left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)\right) \cdot b\right) \cdot b\right)} \]
                4. Step-by-step derivation
                  1. lift-exp.f64N/A

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

                    \[\leadsto \mathsf{fma}\left(e^{\color{blue}{\log \left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\frac{1}{180} \cdot angle\right)\right)\right)\right) \cdot a\right)}}, a, \left(\left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\frac{1}{180} \cdot angle\right)\right)\right)\right) \cdot b\right) \cdot b\right) \]
                  3. rem-exp-log70.6

                    \[\leadsto \mathsf{fma}\left(\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)\right) \cdot a}, a, \left(\left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)\right) \cdot b\right) \cdot b\right) \]
                5. Applied rewrites70.6%

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

                  \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{2}, \cos \left(\frac{1}{90} \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right), \frac{1}{2}\right) \cdot a, a, \left(\color{blue}{1} \cdot b\right) \cdot b\right) \]
                7. Step-by-step derivation
                  1. Applied rewrites70.5%

                    \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-0.5, \cos \left(0.011111111111111112 \cdot \left(\pi \cdot angle\right)\right), 0.5\right) \cdot a, a, \left(\color{blue}{1} \cdot b\right) \cdot b\right) \]

                  if 5.60000000000000028e-15 < a < 5.0000000000000003e139

                  1. Initial program 70.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \left(3.08641975308642 \cdot 10^{-5} \cdot \left(angle \cdot angle\right)\right) \cdot \left(\left(\left(a \cdot a\right) \cdot \pi\right) \cdot \color{blue}{\pi}\right) + {\left(b \cdot 1\right)}^{2} \]
                    4. Applied rewrites66.9%

                      \[\leadsto \color{blue}{\left(3.08641975308642 \cdot 10^{-5} \cdot \left(angle \cdot angle\right)\right) \cdot \left(\left(\left(a \cdot a\right) \cdot \pi\right) \cdot \pi\right)} + {\left(b \cdot 1\right)}^{2} \]

                    if 5.0000000000000003e139 < a

                    1. Initial program 95.6%

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

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

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

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

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

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

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

                        \[\leadsto \frac{1}{32400} \cdot \color{blue}{\left({a}^{2} \cdot \left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)} \]
                      6. Step-by-step derivation
                        1. Applied rewrites78.5%

                          \[\leadsto \left(3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot \left(\left(angle \cdot angle\right) \cdot a\right)\right)\right) \cdot \color{blue}{\left(\pi \cdot \pi\right)} \]
                        2. Step-by-step derivation
                          1. Applied rewrites92.9%

                            \[\leadsto \left(\left(\left(3.08641975308642 \cdot 10^{-5} \cdot a\right) \cdot angle\right) \cdot \left(a \cdot angle\right)\right) \cdot \left(\pi \cdot \pi\right) \]
                        3. Recombined 3 regimes into one program.
                        4. Final simplification73.6%

                          \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 5.6 \cdot 10^{-15}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.5, \cos \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right), 0.5\right) \cdot a, a, \left(1 \cdot b\right) \cdot b\right)\\ \mathbf{elif}\;a \leq 5 \cdot 10^{+139}:\\ \;\;\;\;\left(\left(\left(a \cdot a\right) \cdot \pi\right) \cdot \pi\right) \cdot \left(\left(angle \cdot angle\right) \cdot 3.08641975308642 \cdot 10^{-5}\right) + {\left(1 \cdot b\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\left(3.08641975308642 \cdot 10^{-5} \cdot a\right) \cdot angle\right) \cdot \left(angle \cdot a\right)\right) \cdot \left(\pi \cdot \pi\right)\\ \end{array} \]
                        5. Add Preprocessing

                        Alternative 7: 69.7% accurate, 3.1× speedup?

                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq 5.6 \cdot 10^{-15}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.5, \cos \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right), 0.5\right) \cdot a, a, \left(1 \cdot b\right) \cdot b\right)\\ \mathbf{elif}\;a \leq 5 \cdot 10^{+139}:\\ \;\;\;\;\mathsf{fma}\left(\left(\left(3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right)\right) \cdot \pi\right) \cdot \pi, angle \cdot angle, b \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\left(3.08641975308642 \cdot 10^{-5} \cdot a\right) \cdot angle\right) \cdot \left(angle \cdot a\right)\right) \cdot \left(\pi \cdot \pi\right)\\ \end{array} \end{array} \]
                        (FPCore (a b angle)
                         :precision binary64
                         (if (<= a 5.6e-15)
                           (fma
                            (* (fma -0.5 (cos (* 0.011111111111111112 (* angle PI))) 0.5) a)
                            a
                            (* (* 1.0 b) b))
                           (if (<= a 5e+139)
                             (fma
                              (* (* (* 3.08641975308642e-5 (* a a)) PI) PI)
                              (* angle angle)
                              (* b b))
                             (* (* (* (* 3.08641975308642e-5 a) angle) (* angle a)) (* PI PI)))))
                        double code(double a, double b, double angle) {
                        	double tmp;
                        	if (a <= 5.6e-15) {
                        		tmp = fma((fma(-0.5, cos((0.011111111111111112 * (angle * ((double) M_PI)))), 0.5) * a), a, ((1.0 * b) * b));
                        	} else if (a <= 5e+139) {
                        		tmp = fma((((3.08641975308642e-5 * (a * a)) * ((double) M_PI)) * ((double) M_PI)), (angle * angle), (b * b));
                        	} else {
                        		tmp = (((3.08641975308642e-5 * a) * angle) * (angle * a)) * (((double) M_PI) * ((double) M_PI));
                        	}
                        	return tmp;
                        }
                        
                        function code(a, b, angle)
                        	tmp = 0.0
                        	if (a <= 5.6e-15)
                        		tmp = fma(Float64(fma(-0.5, cos(Float64(0.011111111111111112 * Float64(angle * pi))), 0.5) * a), a, Float64(Float64(1.0 * b) * b));
                        	elseif (a <= 5e+139)
                        		tmp = fma(Float64(Float64(Float64(3.08641975308642e-5 * Float64(a * a)) * pi) * pi), Float64(angle * angle), Float64(b * b));
                        	else
                        		tmp = Float64(Float64(Float64(Float64(3.08641975308642e-5 * a) * angle) * Float64(angle * a)) * Float64(pi * pi));
                        	end
                        	return tmp
                        end
                        
                        code[a_, b_, angle_] := If[LessEqual[a, 5.6e-15], N[(N[(N[(-0.5 * N[Cos[N[(0.011111111111111112 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision] * a), $MachinePrecision] * a + N[(N[(1.0 * b), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 5e+139], N[(N[(N[(N[(3.08641975308642e-5 * N[(a * a), $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision] * Pi), $MachinePrecision] * N[(angle * angle), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(3.08641975308642e-5 * a), $MachinePrecision] * angle), $MachinePrecision] * N[(angle * a), $MachinePrecision]), $MachinePrecision] * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision]]]
                        
                        \begin{array}{l}
                        
                        \\
                        \begin{array}{l}
                        \mathbf{if}\;a \leq 5.6 \cdot 10^{-15}:\\
                        \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.5, \cos \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right), 0.5\right) \cdot a, a, \left(1 \cdot b\right) \cdot b\right)\\
                        
                        \mathbf{elif}\;a \leq 5 \cdot 10^{+139}:\\
                        \;\;\;\;\mathsf{fma}\left(\left(\left(3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right)\right) \cdot \pi\right) \cdot \pi, angle \cdot angle, b \cdot b\right)\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;\left(\left(\left(3.08641975308642 \cdot 10^{-5} \cdot a\right) \cdot angle\right) \cdot \left(angle \cdot a\right)\right) \cdot \left(\pi \cdot \pi\right)\\
                        
                        
                        \end{array}
                        \end{array}
                        
                        Derivation
                        1. Split input into 3 regimes
                        2. if a < 5.60000000000000028e-15

                          1. Initial program 78.3%

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

                            \[\leadsto \color{blue}{\mathsf{fma}\left(e^{\log \left(\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)\right) \cdot a\right)}, a, \left(\left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)\right) \cdot b\right) \cdot b\right)} \]
                          4. Step-by-step derivation
                            1. lift-exp.f64N/A

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

                              \[\leadsto \mathsf{fma}\left(e^{\color{blue}{\log \left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\frac{1}{180} \cdot angle\right)\right)\right)\right) \cdot a\right)}}, a, \left(\left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\frac{1}{180} \cdot angle\right)\right)\right)\right) \cdot b\right) \cdot b\right) \]
                            3. rem-exp-log70.6

                              \[\leadsto \mathsf{fma}\left(\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)\right) \cdot a}, a, \left(\left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)\right) \cdot b\right) \cdot b\right) \]
                          5. Applied rewrites70.6%

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

                            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{2}, \cos \left(\frac{1}{90} \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right), \frac{1}{2}\right) \cdot a, a, \left(\color{blue}{1} \cdot b\right) \cdot b\right) \]
                          7. Step-by-step derivation
                            1. Applied rewrites70.5%

                              \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-0.5, \cos \left(0.011111111111111112 \cdot \left(\pi \cdot angle\right)\right), 0.5\right) \cdot a, a, \left(\color{blue}{1} \cdot b\right) \cdot b\right) \]

                            if 5.60000000000000028e-15 < a < 5.0000000000000003e139

                            1. Initial program 70.5%

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

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

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

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

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

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

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

                                \[\leadsto \mathsf{fma}\left(\frac{1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right), \color{blue}{angle} \cdot angle, b \cdot b\right) \]
                              6. Step-by-step derivation
                                1. Applied rewrites66.8%

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

                                if 5.0000000000000003e139 < a

                                1. Initial program 95.6%

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

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

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

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

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

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

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

                                    \[\leadsto \frac{1}{32400} \cdot \color{blue}{\left({a}^{2} \cdot \left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)} \]
                                  6. Step-by-step derivation
                                    1. Applied rewrites78.5%

                                      \[\leadsto \left(3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot \left(\left(angle \cdot angle\right) \cdot a\right)\right)\right) \cdot \color{blue}{\left(\pi \cdot \pi\right)} \]
                                    2. Step-by-step derivation
                                      1. Applied rewrites92.9%

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

                                      \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 5.6 \cdot 10^{-15}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.5, \cos \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right), 0.5\right) \cdot a, a, \left(1 \cdot b\right) \cdot b\right)\\ \mathbf{elif}\;a \leq 5 \cdot 10^{+139}:\\ \;\;\;\;\mathsf{fma}\left(\left(\left(3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right)\right) \cdot \pi\right) \cdot \pi, angle \cdot angle, b \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\left(3.08641975308642 \cdot 10^{-5} \cdot a\right) \cdot angle\right) \cdot \left(angle \cdot a\right)\right) \cdot \left(\pi \cdot \pi\right)\\ \end{array} \]
                                    5. Add Preprocessing

                                    Alternative 8: 64.1% accurate, 3.4× speedup?

                                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq 3.75 \cdot 10^{-65}:\\ \;\;\;\;\mathsf{fma}\left(\cos \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right), 0.5, 0.5\right) \cdot \left(b \cdot b\right)\\ \mathbf{elif}\;a \leq 5 \cdot 10^{+139}:\\ \;\;\;\;\mathsf{fma}\left(\left(\left(3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right)\right) \cdot \pi\right) \cdot \pi, angle \cdot angle, b \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\left(3.08641975308642 \cdot 10^{-5} \cdot a\right) \cdot angle\right) \cdot \left(angle \cdot a\right)\right) \cdot \left(\pi \cdot \pi\right)\\ \end{array} \end{array} \]
                                    (FPCore (a b angle)
                                     :precision binary64
                                     (if (<= a 3.75e-65)
                                       (* (fma (cos (* 0.011111111111111112 (* angle PI))) 0.5 0.5) (* b b))
                                       (if (<= a 5e+139)
                                         (fma
                                          (* (* (* 3.08641975308642e-5 (* a a)) PI) PI)
                                          (* angle angle)
                                          (* b b))
                                         (* (* (* (* 3.08641975308642e-5 a) angle) (* angle a)) (* PI PI)))))
                                    double code(double a, double b, double angle) {
                                    	double tmp;
                                    	if (a <= 3.75e-65) {
                                    		tmp = fma(cos((0.011111111111111112 * (angle * ((double) M_PI)))), 0.5, 0.5) * (b * b);
                                    	} else if (a <= 5e+139) {
                                    		tmp = fma((((3.08641975308642e-5 * (a * a)) * ((double) M_PI)) * ((double) M_PI)), (angle * angle), (b * b));
                                    	} else {
                                    		tmp = (((3.08641975308642e-5 * a) * angle) * (angle * a)) * (((double) M_PI) * ((double) M_PI));
                                    	}
                                    	return tmp;
                                    }
                                    
                                    function code(a, b, angle)
                                    	tmp = 0.0
                                    	if (a <= 3.75e-65)
                                    		tmp = Float64(fma(cos(Float64(0.011111111111111112 * Float64(angle * pi))), 0.5, 0.5) * Float64(b * b));
                                    	elseif (a <= 5e+139)
                                    		tmp = fma(Float64(Float64(Float64(3.08641975308642e-5 * Float64(a * a)) * pi) * pi), Float64(angle * angle), Float64(b * b));
                                    	else
                                    		tmp = Float64(Float64(Float64(Float64(3.08641975308642e-5 * a) * angle) * Float64(angle * a)) * Float64(pi * pi));
                                    	end
                                    	return tmp
                                    end
                                    
                                    code[a_, b_, angle_] := If[LessEqual[a, 3.75e-65], N[(N[(N[Cos[N[(0.011111111111111112 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.5 + 0.5), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 5e+139], N[(N[(N[(N[(3.08641975308642e-5 * N[(a * a), $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision] * Pi), $MachinePrecision] * N[(angle * angle), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(3.08641975308642e-5 * a), $MachinePrecision] * angle), $MachinePrecision] * N[(angle * a), $MachinePrecision]), $MachinePrecision] * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision]]]
                                    
                                    \begin{array}{l}
                                    
                                    \\
                                    \begin{array}{l}
                                    \mathbf{if}\;a \leq 3.75 \cdot 10^{-65}:\\
                                    \;\;\;\;\mathsf{fma}\left(\cos \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right), 0.5, 0.5\right) \cdot \left(b \cdot b\right)\\
                                    
                                    \mathbf{elif}\;a \leq 5 \cdot 10^{+139}:\\
                                    \;\;\;\;\mathsf{fma}\left(\left(\left(3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right)\right) \cdot \pi\right) \cdot \pi, angle \cdot angle, b \cdot b\right)\\
                                    
                                    \mathbf{else}:\\
                                    \;\;\;\;\left(\left(\left(3.08641975308642 \cdot 10^{-5} \cdot a\right) \cdot angle\right) \cdot \left(angle \cdot a\right)\right) \cdot \left(\pi \cdot \pi\right)\\
                                    
                                    
                                    \end{array}
                                    \end{array}
                                    
                                    Derivation
                                    1. Split input into 3 regimes
                                    2. if a < 3.7500000000000001e-65

                                      1. Initial program 79.4%

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

                                        \[\leadsto \color{blue}{\mathsf{fma}\left(e^{\log \left(\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)\right) \cdot a\right)}, a, \left(\left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)\right) \cdot b\right) \cdot b\right)} \]
                                      4. Taylor expanded in a around 0

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

                                          \[\leadsto \color{blue}{\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}^{2}} \]
                                        2. lower-*.f64N/A

                                          \[\leadsto \color{blue}{\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}^{2}} \]
                                        3. +-commutativeN/A

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

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

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

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

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

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

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

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

                                          \[\leadsto \mathsf{fma}\left(\cos \left(\frac{1}{90} \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right), \frac{1}{2}, \frac{1}{2}\right) \cdot \color{blue}{\left(b \cdot b\right)} \]
                                        12. lower-*.f6464.6

                                          \[\leadsto \mathsf{fma}\left(\cos \left(0.011111111111111112 \cdot \left(\pi \cdot angle\right)\right), 0.5, 0.5\right) \cdot \color{blue}{\left(b \cdot b\right)} \]
                                      6. Applied rewrites64.6%

                                        \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(0.011111111111111112 \cdot \left(\pi \cdot angle\right)\right), 0.5, 0.5\right) \cdot \left(b \cdot b\right)} \]

                                      if 3.7500000000000001e-65 < a < 5.0000000000000003e139

                                      1. Initial program 68.9%

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

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

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

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

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

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

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

                                          \[\leadsto \mathsf{fma}\left(\frac{1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right), \color{blue}{angle} \cdot angle, b \cdot b\right) \]
                                        6. Step-by-step derivation
                                          1. Applied rewrites64.3%

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

                                          if 5.0000000000000003e139 < a

                                          1. Initial program 95.6%

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

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

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

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

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

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

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

                                              \[\leadsto \frac{1}{32400} \cdot \color{blue}{\left({a}^{2} \cdot \left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)} \]
                                            6. Step-by-step derivation
                                              1. Applied rewrites78.5%

                                                \[\leadsto \left(3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot \left(\left(angle \cdot angle\right) \cdot a\right)\right)\right) \cdot \color{blue}{\left(\pi \cdot \pi\right)} \]
                                              2. Step-by-step derivation
                                                1. Applied rewrites92.9%

                                                  \[\leadsto \left(\left(\left(3.08641975308642 \cdot 10^{-5} \cdot a\right) \cdot angle\right) \cdot \left(a \cdot angle\right)\right) \cdot \left(\pi \cdot \pi\right) \]
                                              3. Recombined 3 regimes into one program.
                                              4. Final simplification69.0%

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

                                              Alternative 9: 64.2% accurate, 9.1× speedup?

                                              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq 3.75 \cdot 10^{-65}:\\ \;\;\;\;b \cdot b\\ \mathbf{elif}\;a \leq 5 \cdot 10^{+139}:\\ \;\;\;\;\mathsf{fma}\left(\left(\left(3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right)\right) \cdot \pi\right) \cdot \pi, angle \cdot angle, b \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\left(3.08641975308642 \cdot 10^{-5} \cdot a\right) \cdot angle\right) \cdot \left(angle \cdot a\right)\right) \cdot \left(\pi \cdot \pi\right)\\ \end{array} \end{array} \]
                                              (FPCore (a b angle)
                                               :precision binary64
                                               (if (<= a 3.75e-65)
                                                 (* b b)
                                                 (if (<= a 5e+139)
                                                   (fma
                                                    (* (* (* 3.08641975308642e-5 (* a a)) PI) PI)
                                                    (* angle angle)
                                                    (* b b))
                                                   (* (* (* (* 3.08641975308642e-5 a) angle) (* angle a)) (* PI PI)))))
                                              double code(double a, double b, double angle) {
                                              	double tmp;
                                              	if (a <= 3.75e-65) {
                                              		tmp = b * b;
                                              	} else if (a <= 5e+139) {
                                              		tmp = fma((((3.08641975308642e-5 * (a * a)) * ((double) M_PI)) * ((double) M_PI)), (angle * angle), (b * b));
                                              	} else {
                                              		tmp = (((3.08641975308642e-5 * a) * angle) * (angle * a)) * (((double) M_PI) * ((double) M_PI));
                                              	}
                                              	return tmp;
                                              }
                                              
                                              function code(a, b, angle)
                                              	tmp = 0.0
                                              	if (a <= 3.75e-65)
                                              		tmp = Float64(b * b);
                                              	elseif (a <= 5e+139)
                                              		tmp = fma(Float64(Float64(Float64(3.08641975308642e-5 * Float64(a * a)) * pi) * pi), Float64(angle * angle), Float64(b * b));
                                              	else
                                              		tmp = Float64(Float64(Float64(Float64(3.08641975308642e-5 * a) * angle) * Float64(angle * a)) * Float64(pi * pi));
                                              	end
                                              	return tmp
                                              end
                                              
                                              code[a_, b_, angle_] := If[LessEqual[a, 3.75e-65], N[(b * b), $MachinePrecision], If[LessEqual[a, 5e+139], N[(N[(N[(N[(3.08641975308642e-5 * N[(a * a), $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision] * Pi), $MachinePrecision] * N[(angle * angle), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(3.08641975308642e-5 * a), $MachinePrecision] * angle), $MachinePrecision] * N[(angle * a), $MachinePrecision]), $MachinePrecision] * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision]]]
                                              
                                              \begin{array}{l}
                                              
                                              \\
                                              \begin{array}{l}
                                              \mathbf{if}\;a \leq 3.75 \cdot 10^{-65}:\\
                                              \;\;\;\;b \cdot b\\
                                              
                                              \mathbf{elif}\;a \leq 5 \cdot 10^{+139}:\\
                                              \;\;\;\;\mathsf{fma}\left(\left(\left(3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right)\right) \cdot \pi\right) \cdot \pi, angle \cdot angle, b \cdot b\right)\\
                                              
                                              \mathbf{else}:\\
                                              \;\;\;\;\left(\left(\left(3.08641975308642 \cdot 10^{-5} \cdot a\right) \cdot angle\right) \cdot \left(angle \cdot a\right)\right) \cdot \left(\pi \cdot \pi\right)\\
                                              
                                              
                                              \end{array}
                                              \end{array}
                                              
                                              Derivation
                                              1. Split input into 3 regimes
                                              2. if a < 3.7500000000000001e-65

                                                1. Initial program 79.4%

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

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

                                                    \[\leadsto \color{blue}{b \cdot b} \]
                                                  2. lower-*.f6464.6

                                                    \[\leadsto \color{blue}{b \cdot b} \]
                                                5. Applied rewrites64.6%

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

                                                if 3.7500000000000001e-65 < a < 5.0000000000000003e139

                                                1. Initial program 68.9%

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

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

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

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

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

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

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

                                                    \[\leadsto \mathsf{fma}\left(\frac{1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right), \color{blue}{angle} \cdot angle, b \cdot b\right) \]
                                                  6. Step-by-step derivation
                                                    1. Applied rewrites64.3%

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

                                                    if 5.0000000000000003e139 < a

                                                    1. Initial program 95.6%

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

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

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

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

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

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

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

                                                        \[\leadsto \frac{1}{32400} \cdot \color{blue}{\left({a}^{2} \cdot \left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)} \]
                                                      6. Step-by-step derivation
                                                        1. Applied rewrites78.5%

                                                          \[\leadsto \left(3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot \left(\left(angle \cdot angle\right) \cdot a\right)\right)\right) \cdot \color{blue}{\left(\pi \cdot \pi\right)} \]
                                                        2. Step-by-step derivation
                                                          1. Applied rewrites92.9%

                                                            \[\leadsto \left(\left(\left(3.08641975308642 \cdot 10^{-5} \cdot a\right) \cdot angle\right) \cdot \left(a \cdot angle\right)\right) \cdot \left(\pi \cdot \pi\right) \]
                                                        3. Recombined 3 regimes into one program.
                                                        4. Final simplification69.0%

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

                                                        Alternative 10: 62.8% accurate, 12.1× speedup?

                                                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq 2.7 \cdot 10^{+139}:\\ \;\;\;\;b \cdot b\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\left(3.08641975308642 \cdot 10^{-5} \cdot a\right) \cdot angle\right) \cdot \left(angle \cdot a\right)\right) \cdot \left(\pi \cdot \pi\right)\\ \end{array} \end{array} \]
                                                        (FPCore (a b angle)
                                                         :precision binary64
                                                         (if (<= a 2.7e+139)
                                                           (* b b)
                                                           (* (* (* (* 3.08641975308642e-5 a) angle) (* angle a)) (* PI PI))))
                                                        double code(double a, double b, double angle) {
                                                        	double tmp;
                                                        	if (a <= 2.7e+139) {
                                                        		tmp = b * b;
                                                        	} else {
                                                        		tmp = (((3.08641975308642e-5 * a) * angle) * (angle * a)) * (((double) M_PI) * ((double) M_PI));
                                                        	}
                                                        	return tmp;
                                                        }
                                                        
                                                        public static double code(double a, double b, double angle) {
                                                        	double tmp;
                                                        	if (a <= 2.7e+139) {
                                                        		tmp = b * b;
                                                        	} else {
                                                        		tmp = (((3.08641975308642e-5 * a) * angle) * (angle * a)) * (Math.PI * Math.PI);
                                                        	}
                                                        	return tmp;
                                                        }
                                                        
                                                        def code(a, b, angle):
                                                        	tmp = 0
                                                        	if a <= 2.7e+139:
                                                        		tmp = b * b
                                                        	else:
                                                        		tmp = (((3.08641975308642e-5 * a) * angle) * (angle * a)) * (math.pi * math.pi)
                                                        	return tmp
                                                        
                                                        function code(a, b, angle)
                                                        	tmp = 0.0
                                                        	if (a <= 2.7e+139)
                                                        		tmp = Float64(b * b);
                                                        	else
                                                        		tmp = Float64(Float64(Float64(Float64(3.08641975308642e-5 * a) * angle) * Float64(angle * a)) * Float64(pi * pi));
                                                        	end
                                                        	return tmp
                                                        end
                                                        
                                                        function tmp_2 = code(a, b, angle)
                                                        	tmp = 0.0;
                                                        	if (a <= 2.7e+139)
                                                        		tmp = b * b;
                                                        	else
                                                        		tmp = (((3.08641975308642e-5 * a) * angle) * (angle * a)) * (pi * pi);
                                                        	end
                                                        	tmp_2 = tmp;
                                                        end
                                                        
                                                        code[a_, b_, angle_] := If[LessEqual[a, 2.7e+139], N[(b * b), $MachinePrecision], N[(N[(N[(N[(3.08641975308642e-5 * a), $MachinePrecision] * angle), $MachinePrecision] * N[(angle * a), $MachinePrecision]), $MachinePrecision] * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision]]
                                                        
                                                        \begin{array}{l}
                                                        
                                                        \\
                                                        \begin{array}{l}
                                                        \mathbf{if}\;a \leq 2.7 \cdot 10^{+139}:\\
                                                        \;\;\;\;b \cdot b\\
                                                        
                                                        \mathbf{else}:\\
                                                        \;\;\;\;\left(\left(\left(3.08641975308642 \cdot 10^{-5} \cdot a\right) \cdot angle\right) \cdot \left(angle \cdot a\right)\right) \cdot \left(\pi \cdot \pi\right)\\
                                                        
                                                        
                                                        \end{array}
                                                        \end{array}
                                                        
                                                        Derivation
                                                        1. Split input into 2 regimes
                                                        2. if a < 2.6999999999999998e139

                                                          1. Initial program 77.1%

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

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

                                                              \[\leadsto \color{blue}{b \cdot b} \]
                                                            2. lower-*.f6462.6

                                                              \[\leadsto \color{blue}{b \cdot b} \]
                                                          5. Applied rewrites62.6%

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

                                                          if 2.6999999999999998e139 < a

                                                          1. Initial program 95.6%

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

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

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

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

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

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

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

                                                              \[\leadsto \frac{1}{32400} \cdot \color{blue}{\left({a}^{2} \cdot \left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)} \]
                                                            6. Step-by-step derivation
                                                              1. Applied rewrites78.5%

                                                                \[\leadsto \left(3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot \left(\left(angle \cdot angle\right) \cdot a\right)\right)\right) \cdot \color{blue}{\left(\pi \cdot \pi\right)} \]
                                                              2. Step-by-step derivation
                                                                1. Applied rewrites92.9%

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

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

                                                              Alternative 11: 62.4% accurate, 12.1× speedup?

                                                              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq 5 \cdot 10^{+139}:\\ \;\;\;\;b \cdot b\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\left(\left(angle \cdot a\right) \cdot angle\right) \cdot a\right) \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(\pi \cdot \pi\right)\\ \end{array} \end{array} \]
                                                              (FPCore (a b angle)
                                                               :precision binary64
                                                               (if (<= a 5e+139)
                                                                 (* b b)
                                                                 (* (* (* (* (* angle a) angle) a) 3.08641975308642e-5) (* PI PI))))
                                                              double code(double a, double b, double angle) {
                                                              	double tmp;
                                                              	if (a <= 5e+139) {
                                                              		tmp = b * b;
                                                              	} else {
                                                              		tmp = ((((angle * a) * angle) * a) * 3.08641975308642e-5) * (((double) M_PI) * ((double) M_PI));
                                                              	}
                                                              	return tmp;
                                                              }
                                                              
                                                              public static double code(double a, double b, double angle) {
                                                              	double tmp;
                                                              	if (a <= 5e+139) {
                                                              		tmp = b * b;
                                                              	} else {
                                                              		tmp = ((((angle * a) * angle) * a) * 3.08641975308642e-5) * (Math.PI * Math.PI);
                                                              	}
                                                              	return tmp;
                                                              }
                                                              
                                                              def code(a, b, angle):
                                                              	tmp = 0
                                                              	if a <= 5e+139:
                                                              		tmp = b * b
                                                              	else:
                                                              		tmp = ((((angle * a) * angle) * a) * 3.08641975308642e-5) * (math.pi * math.pi)
                                                              	return tmp
                                                              
                                                              function code(a, b, angle)
                                                              	tmp = 0.0
                                                              	if (a <= 5e+139)
                                                              		tmp = Float64(b * b);
                                                              	else
                                                              		tmp = Float64(Float64(Float64(Float64(Float64(angle * a) * angle) * a) * 3.08641975308642e-5) * Float64(pi * pi));
                                                              	end
                                                              	return tmp
                                                              end
                                                              
                                                              function tmp_2 = code(a, b, angle)
                                                              	tmp = 0.0;
                                                              	if (a <= 5e+139)
                                                              		tmp = b * b;
                                                              	else
                                                              		tmp = ((((angle * a) * angle) * a) * 3.08641975308642e-5) * (pi * pi);
                                                              	end
                                                              	tmp_2 = tmp;
                                                              end
                                                              
                                                              code[a_, b_, angle_] := If[LessEqual[a, 5e+139], N[(b * b), $MachinePrecision], N[(N[(N[(N[(N[(angle * a), $MachinePrecision] * angle), $MachinePrecision] * a), $MachinePrecision] * 3.08641975308642e-5), $MachinePrecision] * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision]]
                                                              
                                                              \begin{array}{l}
                                                              
                                                              \\
                                                              \begin{array}{l}
                                                              \mathbf{if}\;a \leq 5 \cdot 10^{+139}:\\
                                                              \;\;\;\;b \cdot b\\
                                                              
                                                              \mathbf{else}:\\
                                                              \;\;\;\;\left(\left(\left(\left(angle \cdot a\right) \cdot angle\right) \cdot a\right) \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(\pi \cdot \pi\right)\\
                                                              
                                                              
                                                              \end{array}
                                                              \end{array}
                                                              
                                                              Derivation
                                                              1. Split input into 2 regimes
                                                              2. if a < 5.0000000000000003e139

                                                                1. Initial program 77.1%

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

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

                                                                    \[\leadsto \color{blue}{b \cdot b} \]
                                                                  2. lower-*.f6462.6

                                                                    \[\leadsto \color{blue}{b \cdot b} \]
                                                                5. Applied rewrites62.6%

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

                                                                if 5.0000000000000003e139 < a

                                                                1. Initial program 95.6%

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

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

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

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

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

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

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

                                                                    \[\leadsto \frac{1}{32400} \cdot \color{blue}{\left({a}^{2} \cdot \left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)} \]
                                                                  6. Step-by-step derivation
                                                                    1. Applied rewrites78.5%

                                                                      \[\leadsto \left(3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot \left(\left(angle \cdot angle\right) \cdot a\right)\right)\right) \cdot \color{blue}{\left(\pi \cdot \pi\right)} \]
                                                                    2. Step-by-step derivation
                                                                      1. Applied rewrites88.2%

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

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

                                                                    Alternative 12: 61.0% accurate, 12.1× speedup?

                                                                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq 5.2 \cdot 10^{+139}:\\ \;\;\;\;b \cdot b\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\left(angle \cdot angle\right) \cdot a\right) \cdot \left(\pi \cdot \pi\right)\right) \cdot \left(3.08641975308642 \cdot 10^{-5} \cdot a\right)\\ \end{array} \end{array} \]
                                                                    (FPCore (a b angle)
                                                                     :precision binary64
                                                                     (if (<= a 5.2e+139)
                                                                       (* b b)
                                                                       (* (* (* (* angle angle) a) (* PI PI)) (* 3.08641975308642e-5 a))))
                                                                    double code(double a, double b, double angle) {
                                                                    	double tmp;
                                                                    	if (a <= 5.2e+139) {
                                                                    		tmp = b * b;
                                                                    	} else {
                                                                    		tmp = (((angle * angle) * a) * (((double) M_PI) * ((double) M_PI))) * (3.08641975308642e-5 * a);
                                                                    	}
                                                                    	return tmp;
                                                                    }
                                                                    
                                                                    public static double code(double a, double b, double angle) {
                                                                    	double tmp;
                                                                    	if (a <= 5.2e+139) {
                                                                    		tmp = b * b;
                                                                    	} else {
                                                                    		tmp = (((angle * angle) * a) * (Math.PI * Math.PI)) * (3.08641975308642e-5 * a);
                                                                    	}
                                                                    	return tmp;
                                                                    }
                                                                    
                                                                    def code(a, b, angle):
                                                                    	tmp = 0
                                                                    	if a <= 5.2e+139:
                                                                    		tmp = b * b
                                                                    	else:
                                                                    		tmp = (((angle * angle) * a) * (math.pi * math.pi)) * (3.08641975308642e-5 * a)
                                                                    	return tmp
                                                                    
                                                                    function code(a, b, angle)
                                                                    	tmp = 0.0
                                                                    	if (a <= 5.2e+139)
                                                                    		tmp = Float64(b * b);
                                                                    	else
                                                                    		tmp = Float64(Float64(Float64(Float64(angle * angle) * a) * Float64(pi * pi)) * Float64(3.08641975308642e-5 * a));
                                                                    	end
                                                                    	return tmp
                                                                    end
                                                                    
                                                                    function tmp_2 = code(a, b, angle)
                                                                    	tmp = 0.0;
                                                                    	if (a <= 5.2e+139)
                                                                    		tmp = b * b;
                                                                    	else
                                                                    		tmp = (((angle * angle) * a) * (pi * pi)) * (3.08641975308642e-5 * a);
                                                                    	end
                                                                    	tmp_2 = tmp;
                                                                    end
                                                                    
                                                                    code[a_, b_, angle_] := If[LessEqual[a, 5.2e+139], N[(b * b), $MachinePrecision], N[(N[(N[(N[(angle * angle), $MachinePrecision] * a), $MachinePrecision] * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision] * N[(3.08641975308642e-5 * a), $MachinePrecision]), $MachinePrecision]]
                                                                    
                                                                    \begin{array}{l}
                                                                    
                                                                    \\
                                                                    \begin{array}{l}
                                                                    \mathbf{if}\;a \leq 5.2 \cdot 10^{+139}:\\
                                                                    \;\;\;\;b \cdot b\\
                                                                    
                                                                    \mathbf{else}:\\
                                                                    \;\;\;\;\left(\left(\left(angle \cdot angle\right) \cdot a\right) \cdot \left(\pi \cdot \pi\right)\right) \cdot \left(3.08641975308642 \cdot 10^{-5} \cdot a\right)\\
                                                                    
                                                                    
                                                                    \end{array}
                                                                    \end{array}
                                                                    
                                                                    Derivation
                                                                    1. Split input into 2 regimes
                                                                    2. if a < 5.20000000000000044e139

                                                                      1. Initial program 77.1%

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

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

                                                                          \[\leadsto \color{blue}{b \cdot b} \]
                                                                        2. lower-*.f6462.6

                                                                          \[\leadsto \color{blue}{b \cdot b} \]
                                                                      5. Applied rewrites62.6%

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

                                                                      if 5.20000000000000044e139 < a

                                                                      1. Initial program 95.6%

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

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

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

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

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

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

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

                                                                          \[\leadsto \frac{1}{32400} \cdot \color{blue}{\left({a}^{2} \cdot \left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)} \]
                                                                        6. Step-by-step derivation
                                                                          1. Applied rewrites78.5%

                                                                            \[\leadsto \left(3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot \left(\left(angle \cdot angle\right) \cdot a\right)\right)\right) \cdot \color{blue}{\left(\pi \cdot \pi\right)} \]
                                                                          2. Step-by-step derivation
                                                                            1. Applied rewrites78.6%

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

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

                                                                          Alternative 13: 56.8% accurate, 74.7× speedup?

                                                                          \[\begin{array}{l} \\ b \cdot b \end{array} \]
                                                                          (FPCore (a b angle) :precision binary64 (* b b))
                                                                          double code(double a, double b, double angle) {
                                                                          	return b * b;
                                                                          }
                                                                          
                                                                          real(8) function code(a, b, angle)
                                                                              real(8), intent (in) :: a
                                                                              real(8), intent (in) :: b
                                                                              real(8), intent (in) :: angle
                                                                              code = b * b
                                                                          end function
                                                                          
                                                                          public static double code(double a, double b, double angle) {
                                                                          	return b * b;
                                                                          }
                                                                          
                                                                          def code(a, b, angle):
                                                                          	return b * b
                                                                          
                                                                          function code(a, b, angle)
                                                                          	return Float64(b * b)
                                                                          end
                                                                          
                                                                          function tmp = code(a, b, angle)
                                                                          	tmp = b * b;
                                                                          end
                                                                          
                                                                          code[a_, b_, angle_] := N[(b * b), $MachinePrecision]
                                                                          
                                                                          \begin{array}{l}
                                                                          
                                                                          \\
                                                                          b \cdot b
                                                                          \end{array}
                                                                          
                                                                          Derivation
                                                                          1. Initial program 80.0%

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

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

                                                                              \[\leadsto \color{blue}{b \cdot b} \]
                                                                            2. lower-*.f6456.7

                                                                              \[\leadsto \color{blue}{b \cdot b} \]
                                                                          5. Applied rewrites56.7%

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

                                                                          Reproduce

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