ab-angle->ABCF A

Percentage Accurate: 79.6% → 79.6%
Time: 7.9s
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.6% accurate, N/A× 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}
Derivation
  1. Initial program 80.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. Add Preprocessing

Alternative 2: 79.6% accurate, N/A× speedup?

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

\\
{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\left(0.005555555555555556 \cdot angle\right) \cdot \pi\right)\right)}^{2}
\end{array}
Derivation
  1. Initial program 80.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 \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\color{blue}{\left(\frac{1}{180} \cdot angle\right)} \cdot \pi\right)\right)}^{2} \]
  4. Step-by-step derivation
    1. lower-*.f6480.6

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

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

Alternative 3: 79.6% accurate, N/A× speedup?

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

\\
\begin{array}{l}
t_0 := \left(\pi \cdot angle\right) \cdot 0.005555555555555556\\
{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(\left({\left(\frac{-1}{b}\right)}^{-1} \cdot \mathsf{fma}\left(\sin \left(0.5 \cdot \pi\right), \cos t\_0, \sin \left(\mathsf{fma}\left(0.5, \pi, \frac{\pi}{2}\right)\right) \cdot \sin t\_0\right)\right) \cdot -1\right)}^{2}
\end{array}
\end{array}
Derivation
  1. Initial program 80.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. Step-by-step derivation
    1. lift-pow.f64N/A

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

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

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

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

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

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

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

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

      \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + \color{blue}{{\left(e^{\log \left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}^{2}} \]
  4. Applied rewrites30.4%

    \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + \color{blue}{{\left(e^{\log \sin \left(\mathsf{fma}\left(\pi, \frac{angle}{180}, \frac{\pi}{2}\right)\right) + \log b}\right)}^{2}} \]
  5. Taylor expanded in b around -inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(\left({\left(\frac{-1}{b}\right)}^{-1} \cdot \mathsf{fma}\left(\sin \left(\frac{1}{2} \cdot \pi\right), \cos \left(\left(\pi \cdot angle\right) \cdot \frac{1}{180}\right), \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) \cdot \sin \left(\left(\pi \cdot angle\right) \cdot \frac{1}{180}\right)\right)\right) \cdot -1\right)}^{2} \]
  9. Applied rewrites80.5%

    \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(\left({\left(\frac{-1}{b}\right)}^{-1} \cdot \mathsf{fma}\left(\sin \left(0.5 \cdot \pi\right), \cos \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right), \sin \left(\mathsf{fma}\left(0.5, \pi, \frac{\pi}{2}\right)\right) \cdot \sin \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)\right)\right) \cdot -1\right)}^{2} \]
  10. Add Preprocessing

Alternative 4: 79.6% accurate, N/A× speedup?

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

\\
\begin{array}{l}
t_0 := \sin \left(\mathsf{fma}\left(0.5, \pi, -0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)\\
{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + \left(b \cdot b\right) \cdot \left(t\_0 \cdot t\_0\right)
\end{array}
\end{array}
Derivation
  1. Initial program 80.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. Step-by-step derivation
    1. lift-cos.f64N/A

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\left(-\pi \cdot \frac{angle}{180}\right) + \color{blue}{\frac{\mathsf{PI}\left(\right)}{2}}\right)\right)}^{2} \]
    13. lift-PI.f6480.5

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

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

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

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

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

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

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

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

    \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + \color{blue}{\left(b \cdot b\right) \cdot \left(\sin \left(\mathsf{fma}\left(0.5, \pi, -0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right) \cdot \sin \left(\mathsf{fma}\left(0.5, \pi, -0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)\right)} \]
  8. Add Preprocessing

Alternative 5: 79.5% accurate, N/A× speedup?

\[\begin{array}{l} \\ {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\sin \left(\mathsf{fma}\left(0.5, \pi, \left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)\right)}^{2} \cdot \left(b \cdot b\right) \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (+
  (pow (* a (sin (* (/ angle 180.0) PI))) 2.0)
  (*
   (pow (sin (fma 0.5 PI (* (* PI angle) 0.005555555555555556))) 2.0)
   (* b b))))
double code(double a, double b, double angle) {
	return pow((a * sin(((angle / 180.0) * ((double) M_PI)))), 2.0) + (pow(sin(fma(0.5, ((double) M_PI), ((((double) M_PI) * angle) * 0.005555555555555556))), 2.0) * (b * b));
}
function code(a, b, angle)
	return Float64((Float64(a * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + Float64((sin(fma(0.5, pi, Float64(Float64(pi * angle) * 0.005555555555555556))) ^ 2.0) * Float64(b * b)))
end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(N[Power[N[Sin[N[(0.5 * Pi + N[(N[(Pi * angle), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\sin \left(\mathsf{fma}\left(0.5, \pi, \left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)\right)}^{2} \cdot \left(b \cdot b\right)
\end{array}
Derivation
  1. Initial program 80.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. Step-by-step derivation
    1. lift-pow.f64N/A

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

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

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

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

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

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

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

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

      \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + \color{blue}{{\left(e^{\log \left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}^{2}} \]
  4. Applied rewrites30.4%

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

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

    \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + \color{blue}{{\sin \left(\mathsf{fma}\left(0.5, \pi, \left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)\right)}^{2} \cdot \left(b \cdot b\right)} \]
  7. Final simplification80.4%

    \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\sin \left(\mathsf{fma}\left(0.5, \pi, \left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)\right)}^{2} \cdot \left(b \cdot b\right) \]
  8. Add Preprocessing

Alternative 6: 76.7% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(\mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, 0.5 \cdot \pi\right)\right)\\ t_1 := \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\\ t_2 := \mathsf{fma}\left(a \cdot a, t\_1 \cdot t\_1, \left(b \cdot b\right) \cdot \left(t\_0 \cdot t\_0\right)\right)\\ \mathbf{if}\;angle \leq 1.6 \cdot 10^{+37}:\\ \;\;\;\;{\left(\left(\left(\pi \cdot angle\right) \cdot a\right) \cdot 0.005555555555555556\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;t\_2 + t\_2\\ \end{array} \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (let* ((t_0 (sin (fma 0.005555555555555556 (* angle PI) (* 0.5 PI))))
        (t_1 (sin (* 0.005555555555555556 (* angle PI))))
        (t_2 (fma (* a a) (* t_1 t_1) (* (* b b) (* t_0 t_0)))))
   (if (<= angle 1.6e+37)
     (+
      (pow (* (* (* PI angle) a) 0.005555555555555556) 2.0)
      (pow (* b (cos (* (/ angle 180.0) PI))) 2.0))
     (+ t_2 t_2))))
double code(double a, double b, double angle) {
	double t_0 = sin(fma(0.005555555555555556, (angle * ((double) M_PI)), (0.5 * ((double) M_PI))));
	double t_1 = sin((0.005555555555555556 * (angle * ((double) M_PI))));
	double t_2 = fma((a * a), (t_1 * t_1), ((b * b) * (t_0 * t_0)));
	double tmp;
	if (angle <= 1.6e+37) {
		tmp = pow((((((double) M_PI) * angle) * a) * 0.005555555555555556), 2.0) + pow((b * cos(((angle / 180.0) * ((double) M_PI)))), 2.0);
	} else {
		tmp = t_2 + t_2;
	}
	return tmp;
}
function code(a, b, angle)
	t_0 = sin(fma(0.005555555555555556, Float64(angle * pi), Float64(0.5 * pi)))
	t_1 = sin(Float64(0.005555555555555556 * Float64(angle * pi)))
	t_2 = fma(Float64(a * a), Float64(t_1 * t_1), Float64(Float64(b * b) * Float64(t_0 * t_0)))
	tmp = 0.0
	if (angle <= 1.6e+37)
		tmp = Float64((Float64(Float64(Float64(pi * angle) * a) * 0.005555555555555556) ^ 2.0) + (Float64(b * cos(Float64(Float64(angle / 180.0) * pi))) ^ 2.0));
	else
		tmp = Float64(t_2 + t_2);
	end
	return tmp
end
code[a_, b_, angle_] := Block[{t$95$0 = N[Sin[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision] + N[(0.5 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(a * a), $MachinePrecision] * N[(t$95$1 * t$95$1), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[angle, 1.6e+37], N[(N[Power[N[(N[(N[(Pi * angle), $MachinePrecision] * a), $MachinePrecision] * 0.005555555555555556), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(t$95$2 + t$95$2), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin \left(\mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, 0.5 \cdot \pi\right)\right)\\
t_1 := \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\\
t_2 := \mathsf{fma}\left(a \cdot a, t\_1 \cdot t\_1, \left(b \cdot b\right) \cdot \left(t\_0 \cdot t\_0\right)\right)\\
\mathbf{if}\;angle \leq 1.6 \cdot 10^{+37}:\\
\;\;\;\;{\left(\left(\left(\pi \cdot angle\right) \cdot a\right) \cdot 0.005555555555555556\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}\\

\mathbf{else}:\\
\;\;\;\;t\_2 + t\_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if angle < 1.60000000000000007e37

    1. Initial program 86.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 {\color{blue}{\left(\frac{1}{180} \cdot \left(a \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right)}}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

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

        \[\leadsto {\left(\left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot a\right) \cdot \frac{1}{180}\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
      7. lift-PI.f6482.8

        \[\leadsto {\left(\left(\left(\pi \cdot angle\right) \cdot a\right) \cdot 0.005555555555555556\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
    5. Applied rewrites82.8%

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

    if 1.60000000000000007e37 < angle

    1. Initial program 61.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 rewrites4.0%

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

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

        \[\leadsto \frac{{\left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot a\right)}^{6}}{\mathsf{fma}\left(\left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \left(a \cdot a\right), \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \left(a \cdot a\right), {\left(\sin \left(\mathsf{fma}\left(\pi, \frac{angle}{180}, \frac{\pi}{2}\right)\right) \cdot b\right)}^{4} - \left(\left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \left(a \cdot a\right)\right) \cdot \left(\left(\sin \left(\mathsf{fma}\left(\pi, \frac{angle}{180}, \frac{\pi}{2}\right)\right) \cdot \sin \left(\mathsf{fma}\left(\pi, \frac{angle}{180}, \frac{\pi}{2}\right)\right)\right) \cdot \left(b \cdot b\right)\right)\right)} + \mathsf{fma}\left({a}^{2}, \color{blue}{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}, {b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right) + \frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)}^{2}\right) \]
    6. Applied rewrites4.8%

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

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

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

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

Alternative 7: 60.1% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(\mathsf{fma}\left(0.5, \pi, \frac{\pi}{2}\right)\right)\\ t_1 := \sin \left(0.5 \cdot \pi\right)\\ t_2 := t\_1 \cdot t\_1\\ \mathbf{if}\;b \leq 8 \cdot 10^{+81}:\\ \;\;\;\;\mathsf{fma}\left(angle, \mathsf{fma}\left(-0.011111111111111112 \cdot \left(b \cdot b\right), \left(\pi \cdot t\_0\right) \cdot t\_1, angle \cdot \mathsf{fma}\left(3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right), \pi \cdot \pi, \mathsf{fma}\left(angle \cdot \left(b \cdot b\right), \left(\left(\left(\left(\pi \cdot \pi\right) \cdot \pi\right) \cdot t\_0\right) \cdot t\_1\right) \cdot 2.2862368541380886 \cdot 10^{-7}, \left(b \cdot b\right) \cdot \mathsf{fma}\left(-3.08641975308642 \cdot 10^{-5} \cdot \left(\pi \cdot \pi\right), t\_2, \left(3.08641975308642 \cdot 10^{-5} \cdot \left(\pi \cdot \pi\right)\right) \cdot \left(t\_0 \cdot t\_0\right)\right)\right)\right)\right), \left(b \cdot b\right) \cdot t\_2\right)\\ \mathbf{else}:\\ \;\;\;\;b \cdot b\\ \end{array} \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (let* ((t_0 (sin (fma 0.5 PI (/ PI 2.0))))
        (t_1 (sin (* 0.5 PI)))
        (t_2 (* t_1 t_1)))
   (if (<= b 8e+81)
     (fma
      angle
      (fma
       (* -0.011111111111111112 (* b b))
       (* (* PI t_0) t_1)
       (*
        angle
        (fma
         (* 3.08641975308642e-5 (* a a))
         (* PI PI)
         (fma
          (* angle (* b b))
          (* (* (* (* (* PI PI) PI) t_0) t_1) 2.2862368541380886e-7)
          (*
           (* b b)
           (fma
            (* -3.08641975308642e-5 (* PI PI))
            t_2
            (* (* 3.08641975308642e-5 (* PI PI)) (* t_0 t_0))))))))
      (* (* b b) t_2))
     (* b b))))
double code(double a, double b, double angle) {
	double t_0 = sin(fma(0.5, ((double) M_PI), (((double) M_PI) / 2.0)));
	double t_1 = sin((0.5 * ((double) M_PI)));
	double t_2 = t_1 * t_1;
	double tmp;
	if (b <= 8e+81) {
		tmp = fma(angle, fma((-0.011111111111111112 * (b * b)), ((((double) M_PI) * t_0) * t_1), (angle * fma((3.08641975308642e-5 * (a * a)), (((double) M_PI) * ((double) M_PI)), fma((angle * (b * b)), (((((((double) M_PI) * ((double) M_PI)) * ((double) M_PI)) * t_0) * t_1) * 2.2862368541380886e-7), ((b * b) * fma((-3.08641975308642e-5 * (((double) M_PI) * ((double) M_PI))), t_2, ((3.08641975308642e-5 * (((double) M_PI) * ((double) M_PI))) * (t_0 * t_0)))))))), ((b * b) * t_2));
	} else {
		tmp = b * b;
	}
	return tmp;
}
function code(a, b, angle)
	t_0 = sin(fma(0.5, pi, Float64(pi / 2.0)))
	t_1 = sin(Float64(0.5 * pi))
	t_2 = Float64(t_1 * t_1)
	tmp = 0.0
	if (b <= 8e+81)
		tmp = fma(angle, fma(Float64(-0.011111111111111112 * Float64(b * b)), Float64(Float64(pi * t_0) * t_1), Float64(angle * fma(Float64(3.08641975308642e-5 * Float64(a * a)), Float64(pi * pi), fma(Float64(angle * Float64(b * b)), Float64(Float64(Float64(Float64(Float64(pi * pi) * pi) * t_0) * t_1) * 2.2862368541380886e-7), Float64(Float64(b * b) * fma(Float64(-3.08641975308642e-5 * Float64(pi * pi)), t_2, Float64(Float64(3.08641975308642e-5 * Float64(pi * pi)) * Float64(t_0 * t_0)))))))), Float64(Float64(b * b) * t_2));
	else
		tmp = Float64(b * b);
	end
	return tmp
end
code[a_, b_, angle_] := Block[{t$95$0 = N[Sin[N[(0.5 * Pi + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(0.5 * Pi), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * t$95$1), $MachinePrecision]}, If[LessEqual[b, 8e+81], N[(angle * N[(N[(-0.011111111111111112 * N[(b * b), $MachinePrecision]), $MachinePrecision] * N[(N[(Pi * t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision] + N[(angle * N[(N[(3.08641975308642e-5 * N[(a * a), $MachinePrecision]), $MachinePrecision] * N[(Pi * Pi), $MachinePrecision] + N[(N[(angle * N[(b * b), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(N[(Pi * Pi), $MachinePrecision] * Pi), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision] * 2.2862368541380886e-7), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(N[(-3.08641975308642e-5 * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision] * t$95$2 + N[(N[(3.08641975308642e-5 * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision], N[(b * b), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin \left(\mathsf{fma}\left(0.5, \pi, \frac{\pi}{2}\right)\right)\\
t_1 := \sin \left(0.5 \cdot \pi\right)\\
t_2 := t\_1 \cdot t\_1\\
\mathbf{if}\;b \leq 8 \cdot 10^{+81}:\\
\;\;\;\;\mathsf{fma}\left(angle, \mathsf{fma}\left(-0.011111111111111112 \cdot \left(b \cdot b\right), \left(\pi \cdot t\_0\right) \cdot t\_1, angle \cdot \mathsf{fma}\left(3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right), \pi \cdot \pi, \mathsf{fma}\left(angle \cdot \left(b \cdot b\right), \left(\left(\left(\left(\pi \cdot \pi\right) \cdot \pi\right) \cdot t\_0\right) \cdot t\_1\right) \cdot 2.2862368541380886 \cdot 10^{-7}, \left(b \cdot b\right) \cdot \mathsf{fma}\left(-3.08641975308642 \cdot 10^{-5} \cdot \left(\pi \cdot \pi\right), t\_2, \left(3.08641975308642 \cdot 10^{-5} \cdot \left(\pi \cdot \pi\right)\right) \cdot \left(t\_0 \cdot t\_0\right)\right)\right)\right)\right), \left(b \cdot b\right) \cdot t\_2\right)\\

\mathbf{else}:\\
\;\;\;\;b \cdot b\\


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

    1. Initial program 78.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. Step-by-step derivation
      1. lift-cos.f64N/A

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\left(-\pi \cdot \frac{angle}{180}\right) + \color{blue}{\frac{\mathsf{PI}\left(\right)}{2}}\right)\right)}^{2} \]
      13. lift-PI.f6478.4

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

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

      \[\leadsto \color{blue}{angle \cdot \left(\frac{-1}{90} \cdot \left({b}^{2} \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) + angle \cdot \left(\frac{1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \left(angle \cdot \left({b}^{2} \cdot \left(\frac{1}{17496000} \cdot \left({\mathsf{PI}\left(\right)}^{3} \cdot \left(\cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right)\right) + \frac{1}{5832000} \cdot \left({\mathsf{PI}\left(\right)}^{3} \cdot \left(\cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right) + {b}^{2} \cdot \left(\frac{-1}{32400} \cdot \left({\mathsf{PI}\left(\right)}^{2} \cdot {\sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)}^{2}\right) + \frac{1}{32400} \cdot \left({\mathsf{PI}\left(\right)}^{2} \cdot {\cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)}^{2}\right)\right)\right)\right)\right) + {b}^{2} \cdot {\sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)}^{2}} \]
    6. Applied rewrites45.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(angle, \mathsf{fma}\left(-0.011111111111111112 \cdot \left(b \cdot b\right), \left(\pi \cdot \sin \left(\mathsf{fma}\left(0.5, \pi, \frac{\pi}{2}\right)\right)\right) \cdot \sin \left(0.5 \cdot \pi\right), angle \cdot \mathsf{fma}\left(3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right), \pi \cdot \pi, \mathsf{fma}\left(angle \cdot \left(b \cdot b\right), \left(\left(\left(\left(\pi \cdot \pi\right) \cdot \pi\right) \cdot \sin \left(\mathsf{fma}\left(0.5, \pi, \frac{\pi}{2}\right)\right)\right) \cdot \sin \left(0.5 \cdot \pi\right)\right) \cdot 2.2862368541380886 \cdot 10^{-7}, \left(b \cdot b\right) \cdot \mathsf{fma}\left(-3.08641975308642 \cdot 10^{-5} \cdot \left(\pi \cdot \pi\right), \sin \left(0.5 \cdot \pi\right) \cdot \sin \left(0.5 \cdot \pi\right), \left(3.08641975308642 \cdot 10^{-5} \cdot \left(\pi \cdot \pi\right)\right) \cdot \left(\sin \left(\mathsf{fma}\left(0.5, \pi, \frac{\pi}{2}\right)\right) \cdot \sin \left(\mathsf{fma}\left(0.5, \pi, \frac{\pi}{2}\right)\right)\right)\right)\right)\right)\right), \left(b \cdot b\right) \cdot \left(\sin \left(0.5 \cdot \pi\right) \cdot \sin \left(0.5 \cdot \pi\right)\right)\right)} \]

    if 7.99999999999999937e81 < b

    1. Initial program 89.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 b \cdot \color{blue}{b} \]
      2. lower-*.f6485.1

        \[\leadsto b \cdot \color{blue}{b} \]
    5. Applied rewrites85.1%

      \[\leadsto \color{blue}{b \cdot b} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification53.2%

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

Alternative 8: 57.0% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(\mathsf{fma}\left(0.5, \pi, \pi\right)\right)\\ t_1 := t\_0 \cdot t\_0\\ t_2 := \sin \left(0.5 \cdot \pi\right)\\ t_3 := t\_2 \cdot b\\ t_4 := t\_3 \cdot t\_3\\ t_5 := \sin \left(\mathsf{fma}\left(0.5, \pi, \frac{\pi}{2}\right)\right)\\ t_6 := t\_5 \cdot t\_3\\ t_7 := t\_5 \cdot \pi\\ t_8 := \frac{t\_7 \cdot t\_7}{t\_1}\\ \mathbf{if}\;b \leq 8 \cdot 10^{+81}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right), \pi \cdot \pi, \mathsf{fma}\left(2 \cdot t\_4, \mathsf{fma}\left(\mathsf{fma}\left(t\_8, -3.08641975308642 \cdot 10^{-5}, \left(\pi \cdot \pi\right) \cdot -3.08641975308642 \cdot 10^{-5}\right), 0.5, t\_8 \cdot 1.54320987654321 \cdot 10^{-5}\right), \left(\left(\pi \cdot \pi\right) \cdot \frac{t\_6 \cdot t\_6}{t\_1}\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)\right), angle, \frac{t\_7 \cdot t\_4}{t\_2} \cdot 0.011111111111111112\right), angle, t\_4\right)\\ \mathbf{else}:\\ \;\;\;\;b \cdot b\\ \end{array} \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (let* ((t_0 (sin (fma 0.5 PI PI)))
        (t_1 (* t_0 t_0))
        (t_2 (sin (* 0.5 PI)))
        (t_3 (* t_2 b))
        (t_4 (* t_3 t_3))
        (t_5 (sin (fma 0.5 PI (/ PI 2.0))))
        (t_6 (* t_5 t_3))
        (t_7 (* t_5 PI))
        (t_8 (/ (* t_7 t_7) t_1)))
   (if (<= b 8e+81)
     (fma
      (fma
       (fma
        (* 3.08641975308642e-5 (* a a))
        (* PI PI)
        (fma
         (* 2.0 t_4)
         (fma
          (fma t_8 -3.08641975308642e-5 (* (* PI PI) -3.08641975308642e-5))
          0.5
          (* t_8 1.54320987654321e-5))
         (* (* (* PI PI) (/ (* t_6 t_6) t_1)) 3.08641975308642e-5)))
       angle
       (* (/ (* t_7 t_4) t_2) 0.011111111111111112))
      angle
      t_4)
     (* b b))))
double code(double a, double b, double angle) {
	double t_0 = sin(fma(0.5, ((double) M_PI), ((double) M_PI)));
	double t_1 = t_0 * t_0;
	double t_2 = sin((0.5 * ((double) M_PI)));
	double t_3 = t_2 * b;
	double t_4 = t_3 * t_3;
	double t_5 = sin(fma(0.5, ((double) M_PI), (((double) M_PI) / 2.0)));
	double t_6 = t_5 * t_3;
	double t_7 = t_5 * ((double) M_PI);
	double t_8 = (t_7 * t_7) / t_1;
	double tmp;
	if (b <= 8e+81) {
		tmp = fma(fma(fma((3.08641975308642e-5 * (a * a)), (((double) M_PI) * ((double) M_PI)), fma((2.0 * t_4), fma(fma(t_8, -3.08641975308642e-5, ((((double) M_PI) * ((double) M_PI)) * -3.08641975308642e-5)), 0.5, (t_8 * 1.54320987654321e-5)), (((((double) M_PI) * ((double) M_PI)) * ((t_6 * t_6) / t_1)) * 3.08641975308642e-5))), angle, (((t_7 * t_4) / t_2) * 0.011111111111111112)), angle, t_4);
	} else {
		tmp = b * b;
	}
	return tmp;
}
function code(a, b, angle)
	t_0 = sin(fma(0.5, pi, pi))
	t_1 = Float64(t_0 * t_0)
	t_2 = sin(Float64(0.5 * pi))
	t_3 = Float64(t_2 * b)
	t_4 = Float64(t_3 * t_3)
	t_5 = sin(fma(0.5, pi, Float64(pi / 2.0)))
	t_6 = Float64(t_5 * t_3)
	t_7 = Float64(t_5 * pi)
	t_8 = Float64(Float64(t_7 * t_7) / t_1)
	tmp = 0.0
	if (b <= 8e+81)
		tmp = fma(fma(fma(Float64(3.08641975308642e-5 * Float64(a * a)), Float64(pi * pi), fma(Float64(2.0 * t_4), fma(fma(t_8, -3.08641975308642e-5, Float64(Float64(pi * pi) * -3.08641975308642e-5)), 0.5, Float64(t_8 * 1.54320987654321e-5)), Float64(Float64(Float64(pi * pi) * Float64(Float64(t_6 * t_6) / t_1)) * 3.08641975308642e-5))), angle, Float64(Float64(Float64(t_7 * t_4) / t_2) * 0.011111111111111112)), angle, t_4);
	else
		tmp = Float64(b * b);
	end
	return tmp
end
code[a_, b_, angle_] := Block[{t$95$0 = N[Sin[N[(0.5 * Pi + Pi), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[Sin[N[(0.5 * Pi), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 * b), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 * t$95$3), $MachinePrecision]}, Block[{t$95$5 = N[Sin[N[(0.5 * Pi + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$6 = N[(t$95$5 * t$95$3), $MachinePrecision]}, Block[{t$95$7 = N[(t$95$5 * Pi), $MachinePrecision]}, Block[{t$95$8 = N[(N[(t$95$7 * t$95$7), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[LessEqual[b, 8e+81], N[(N[(N[(N[(3.08641975308642e-5 * N[(a * a), $MachinePrecision]), $MachinePrecision] * N[(Pi * Pi), $MachinePrecision] + N[(N[(2.0 * t$95$4), $MachinePrecision] * N[(N[(t$95$8 * -3.08641975308642e-5 + N[(N[(Pi * Pi), $MachinePrecision] * -3.08641975308642e-5), $MachinePrecision]), $MachinePrecision] * 0.5 + N[(t$95$8 * 1.54320987654321e-5), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(Pi * Pi), $MachinePrecision] * N[(N[(t$95$6 * t$95$6), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * angle + N[(N[(N[(t$95$7 * t$95$4), $MachinePrecision] / t$95$2), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]), $MachinePrecision] * angle + t$95$4), $MachinePrecision], N[(b * b), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin \left(\mathsf{fma}\left(0.5, \pi, \pi\right)\right)\\
t_1 := t\_0 \cdot t\_0\\
t_2 := \sin \left(0.5 \cdot \pi\right)\\
t_3 := t\_2 \cdot b\\
t_4 := t\_3 \cdot t\_3\\
t_5 := \sin \left(\mathsf{fma}\left(0.5, \pi, \frac{\pi}{2}\right)\right)\\
t_6 := t\_5 \cdot t\_3\\
t_7 := t\_5 \cdot \pi\\
t_8 := \frac{t\_7 \cdot t\_7}{t\_1}\\
\mathbf{if}\;b \leq 8 \cdot 10^{+81}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right), \pi \cdot \pi, \mathsf{fma}\left(2 \cdot t\_4, \mathsf{fma}\left(\mathsf{fma}\left(t\_8, -3.08641975308642 \cdot 10^{-5}, \left(\pi \cdot \pi\right) \cdot -3.08641975308642 \cdot 10^{-5}\right), 0.5, t\_8 \cdot 1.54320987654321 \cdot 10^{-5}\right), \left(\left(\pi \cdot \pi\right) \cdot \frac{t\_6 \cdot t\_6}{t\_1}\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)\right), angle, \frac{t\_7 \cdot t\_4}{t\_2} \cdot 0.011111111111111112\right), angle, t\_4\right)\\

\mathbf{else}:\\
\;\;\;\;b \cdot b\\


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

    1. Initial program 78.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. Step-by-step derivation
      1. lift-pow.f64N/A

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

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

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

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

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

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

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

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

        \[\leadsto {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + \color{blue}{{\left(e^{\log \left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}^{2}} \]
    4. Applied rewrites21.8%

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

      \[\leadsto \color{blue}{angle \cdot \left(\frac{1}{90} \cdot \frac{\mathsf{PI}\left(\right) \cdot \left(\cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) \cdot {\left(e^{\log b + \log \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)}\right)}^{2}\right)}{\sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)} + angle \cdot \left(\frac{1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \left(\frac{1}{32400} \cdot \frac{{\mathsf{PI}\left(\right)}^{2} \cdot \left({\cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)}^{2} \cdot {\left(e^{\log b + \log \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)}\right)}^{2}\right)}{{\sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)}^{2}} + 2 \cdot \left({\left(e^{\log b + \log \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)}\right)}^{2} \cdot \left(\frac{1}{64800} \cdot \frac{{\mathsf{PI}\left(\right)}^{2} \cdot {\cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)}^{2}}{{\sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)}^{2}} + \frac{1}{2} \cdot \left(\frac{-1}{32400} \cdot \frac{{\mathsf{PI}\left(\right)}^{2} \cdot {\cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)}^{2}}{{\sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)}^{2}} + \frac{-1}{32400} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)\right)\right)\right)\right) + {\left(e^{\log b + \log \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)}\right)}^{2}} \]
    6. Applied rewrites45.7%

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

    if 7.99999999999999937e81 < b

    1. Initial program 89.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 b \cdot \color{blue}{b} \]
      2. lower-*.f6485.1

        \[\leadsto b \cdot \color{blue}{b} \]
    5. Applied rewrites85.1%

      \[\leadsto \color{blue}{b \cdot b} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification53.5%

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

Alternative 9: 56.2% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(\mathsf{fma}\left(0.005555555555555556 \cdot angle, \pi, \frac{\pi}{2}\right)\right)\\ t_1 := \sin \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right) \cdot a\\ \mathbf{if}\;a \leq 2.2 \cdot 10^{-116} \lor \neg \left(a \leq 1.35 \cdot 10^{+154}\right):\\ \;\;\;\;b \cdot b\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(b \cdot b\right) \cdot \frac{t\_0 \cdot t\_0}{a \cdot a}, a \cdot a, t\_1 \cdot t\_1\right)\\ \end{array} \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (let* ((t_0 (sin (fma (* 0.005555555555555556 angle) PI (/ PI 2.0))))
        (t_1 (* (sin (* (* PI angle) 0.005555555555555556)) a)))
   (if (or (<= a 2.2e-116) (not (<= a 1.35e+154)))
     (* b b)
     (fma (* (* b b) (/ (* t_0 t_0) (* a a))) (* a a) (* t_1 t_1)))))
double code(double a, double b, double angle) {
	double t_0 = sin(fma((0.005555555555555556 * angle), ((double) M_PI), (((double) M_PI) / 2.0)));
	double t_1 = sin(((((double) M_PI) * angle) * 0.005555555555555556)) * a;
	double tmp;
	if ((a <= 2.2e-116) || !(a <= 1.35e+154)) {
		tmp = b * b;
	} else {
		tmp = fma(((b * b) * ((t_0 * t_0) / (a * a))), (a * a), (t_1 * t_1));
	}
	return tmp;
}
function code(a, b, angle)
	t_0 = sin(fma(Float64(0.005555555555555556 * angle), pi, Float64(pi / 2.0)))
	t_1 = Float64(sin(Float64(Float64(pi * angle) * 0.005555555555555556)) * a)
	tmp = 0.0
	if ((a <= 2.2e-116) || !(a <= 1.35e+154))
		tmp = Float64(b * b);
	else
		tmp = fma(Float64(Float64(b * b) * Float64(Float64(t_0 * t_0) / Float64(a * a))), Float64(a * a), Float64(t_1 * t_1));
	end
	return tmp
end
code[a_, b_, angle_] := Block[{t$95$0 = N[Sin[N[(N[(0.005555555555555556 * angle), $MachinePrecision] * Pi + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[N[(N[(Pi * angle), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]], $MachinePrecision] * a), $MachinePrecision]}, If[Or[LessEqual[a, 2.2e-116], N[Not[LessEqual[a, 1.35e+154]], $MachinePrecision]], N[(b * b), $MachinePrecision], N[(N[(N[(b * b), $MachinePrecision] * N[(N[(t$95$0 * t$95$0), $MachinePrecision] / N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(a * a), $MachinePrecision] + N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin \left(\mathsf{fma}\left(0.005555555555555556 \cdot angle, \pi, \frac{\pi}{2}\right)\right)\\
t_1 := \sin \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right) \cdot a\\
\mathbf{if}\;a \leq 2.2 \cdot 10^{-116} \lor \neg \left(a \leq 1.35 \cdot 10^{+154}\right):\\
\;\;\;\;b \cdot b\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(b \cdot b\right) \cdot \frac{t\_0 \cdot t\_0}{a \cdot a}, a \cdot a, t\_1 \cdot t\_1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < 2.2000000000000001e-116 or 1.35000000000000003e154 < a

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

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

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

        \[\leadsto b \cdot \color{blue}{b} \]
    5. Applied rewrites60.2%

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

    if 2.2000000000000001e-116 < a < 1.35000000000000003e154

    1. Initial program 74.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 \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\color{blue}{\left(\frac{1}{180} \cdot angle\right)} \cdot \pi\right)\right)}^{2} \]
    4. Step-by-step derivation
      1. lower-*.f6474.5

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{{b}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{a}^{2}}, \color{blue}{{a}^{2}}, {a}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) \]
    8. Applied rewrites72.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(b \cdot b\right) \cdot \frac{\sin \left(\mathsf{fma}\left(0.005555555555555556 \cdot angle, \pi, \frac{\pi}{2}\right)\right) \cdot \sin \left(\mathsf{fma}\left(0.005555555555555556 \cdot angle, \pi, \frac{\pi}{2}\right)\right)}{a \cdot a}, a \cdot a, \left(\sin \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right) \cdot a\right) \cdot \left(\sin \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right) \cdot a\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification62.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 2.2 \cdot 10^{-116} \lor \neg \left(a \leq 1.35 \cdot 10^{+154}\right):\\ \;\;\;\;b \cdot b\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(b \cdot b\right) \cdot \frac{\sin \left(\mathsf{fma}\left(0.005555555555555556 \cdot angle, \pi, \frac{\pi}{2}\right)\right) \cdot \sin \left(\mathsf{fma}\left(0.005555555555555556 \cdot angle, \pi, \frac{\pi}{2}\right)\right)}{a \cdot a}, a \cdot a, \left(\sin \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right) \cdot a\right) \cdot \left(\sin \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right) \cdot a\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 55.8% accurate, N/A× 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;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(a, b, angle)
use fmin_fmax_functions
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: angle
    code = b * 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.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 \color{blue}{{b}^{2}} \]
  4. Step-by-step derivation
    1. unpow2N/A

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

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

    \[\leadsto \color{blue}{b \cdot b} \]
  6. Final simplification59.6%

    \[\leadsto b \cdot b \]
  7. Add Preprocessing

Alternative 11: 27.8% accurate, N/A× speedup?

\[\begin{array}{l} \\ e^{\log b \cdot 2} \end{array} \]
(FPCore (a b angle) :precision binary64 (exp (* (log b) 2.0)))
double code(double a, double b, double angle) {
	return exp((log(b) * 2.0));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(a, b, angle)
use fmin_fmax_functions
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: angle
    code = exp((log(b) * 2.0d0))
end function
public static double code(double a, double b, double angle) {
	return Math.exp((Math.log(b) * 2.0));
}
def code(a, b, angle):
	return math.exp((math.log(b) * 2.0))
function code(a, b, angle)
	return exp(Float64(log(b) * 2.0))
end
function tmp = code(a, b, angle)
	tmp = exp((log(b) * 2.0));
end
code[a_, b_, angle_] := N[Exp[N[(N[Log[b], $MachinePrecision] * 2.0), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
e^{\log b \cdot 2}
\end{array}
Derivation
  1. Initial program 80.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 \color{blue}{{b}^{2}} \]
  4. Step-by-step derivation
    1. unpow2N/A

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

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

    \[\leadsto \color{blue}{b \cdot b} \]
  6. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto b \cdot \color{blue}{b} \]
    2. pow2N/A

      \[\leadsto {b}^{\color{blue}{2}} \]
    3. pow-to-expN/A

      \[\leadsto e^{\log b \cdot 2} \]
    4. lower-exp.f64N/A

      \[\leadsto e^{\log b \cdot 2} \]
    5. lower-*.f64N/A

      \[\leadsto e^{\log b \cdot 2} \]
    6. lift-log.f6426.1

      \[\leadsto e^{\log b \cdot 2} \]
  7. Applied rewrites26.1%

    \[\leadsto e^{\log b \cdot 2} \]
  8. Final simplification26.1%

    \[\leadsto e^{\log b \cdot 2} \]
  9. Add Preprocessing

Alternative 12: 7.2% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(\mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, 0.5 \cdot \pi\right)\right)\\ t_1 := \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\\ \frac{\mathsf{fma}\left({a}^{6}, {t\_1}^{6}, {b}^{6} \cdot {t\_0}^{6}\right)}{\mathsf{fma}\left({a}^{4}, {t\_1}^{4}, {b}^{4} \cdot {t\_0}^{4}\right) - \left(\left(a \cdot a\right) \cdot \left(b \cdot b\right)\right) \cdot \left(\left(t\_1 \cdot t\_1\right) \cdot \left(t\_0 \cdot t\_0\right)\right)} \end{array} \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (let* ((t_0 (sin (fma 0.005555555555555556 (* angle PI) (* 0.5 PI))))
        (t_1 (sin (* 0.005555555555555556 (* angle PI)))))
   (/
    (fma (pow a 6.0) (pow t_1 6.0) (* (pow b 6.0) (pow t_0 6.0)))
    (-
     (fma (pow a 4.0) (pow t_1 4.0) (* (pow b 4.0) (pow t_0 4.0)))
     (* (* (* a a) (* b b)) (* (* t_1 t_1) (* t_0 t_0)))))))
double code(double a, double b, double angle) {
	double t_0 = sin(fma(0.005555555555555556, (angle * ((double) M_PI)), (0.5 * ((double) M_PI))));
	double t_1 = sin((0.005555555555555556 * (angle * ((double) M_PI))));
	return fma(pow(a, 6.0), pow(t_1, 6.0), (pow(b, 6.0) * pow(t_0, 6.0))) / (fma(pow(a, 4.0), pow(t_1, 4.0), (pow(b, 4.0) * pow(t_0, 4.0))) - (((a * a) * (b * b)) * ((t_1 * t_1) * (t_0 * t_0))));
}
function code(a, b, angle)
	t_0 = sin(fma(0.005555555555555556, Float64(angle * pi), Float64(0.5 * pi)))
	t_1 = sin(Float64(0.005555555555555556 * Float64(angle * pi)))
	return Float64(fma((a ^ 6.0), (t_1 ^ 6.0), Float64((b ^ 6.0) * (t_0 ^ 6.0))) / Float64(fma((a ^ 4.0), (t_1 ^ 4.0), Float64((b ^ 4.0) * (t_0 ^ 4.0))) - Float64(Float64(Float64(a * a) * Float64(b * b)) * Float64(Float64(t_1 * t_1) * Float64(t_0 * t_0)))))
end
code[a_, b_, angle_] := Block[{t$95$0 = N[Sin[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision] + N[(0.5 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[Power[a, 6.0], $MachinePrecision] * N[Power[t$95$1, 6.0], $MachinePrecision] + N[(N[Power[b, 6.0], $MachinePrecision] * N[Power[t$95$0, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Power[a, 4.0], $MachinePrecision] * N[Power[t$95$1, 4.0], $MachinePrecision] + N[(N[Power[b, 4.0], $MachinePrecision] * N[Power[t$95$0, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(a * a), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$1 * t$95$1), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin \left(\mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, 0.5 \cdot \pi\right)\right)\\
t_1 := \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\\
\frac{\mathsf{fma}\left({a}^{6}, {t\_1}^{6}, {b}^{6} \cdot {t\_0}^{6}\right)}{\mathsf{fma}\left({a}^{4}, {t\_1}^{4}, {b}^{4} \cdot {t\_0}^{4}\right) - \left(\left(a \cdot a\right) \cdot \left(b \cdot b\right)\right) \cdot \left(\left(t\_1 \cdot t\_1\right) \cdot \left(t\_0 \cdot t\_0\right)\right)}
\end{array}
\end{array}
Derivation
  1. Initial program 80.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. Applied rewrites11.1%

    \[\leadsto \color{blue}{\frac{{\left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot a\right)}^{6}}{\mathsf{fma}\left(\left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \left(a \cdot a\right), \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \left(a \cdot a\right), {\left(\sin \left(\mathsf{fma}\left(\pi, \frac{angle}{180}, \frac{\pi}{2}\right)\right) \cdot b\right)}^{4} - \left(\left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \left(a \cdot a\right)\right) \cdot \left(\left(\sin \left(\mathsf{fma}\left(\pi, \frac{angle}{180}, \frac{\pi}{2}\right)\right) \cdot \sin \left(\mathsf{fma}\left(\pi, \frac{angle}{180}, \frac{\pi}{2}\right)\right)\right) \cdot \left(b \cdot b\right)\right)\right)} + \frac{{\left(\sin \left(\mathsf{fma}\left(\pi, \frac{angle}{180}, \frac{\pi}{2}\right)\right) \cdot b\right)}^{6}}{\mathsf{fma}\left(\left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \left(a \cdot a\right), \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \left(a \cdot a\right), {\left(\sin \left(\mathsf{fma}\left(\pi, \frac{angle}{180}, \frac{\pi}{2}\right)\right) \cdot b\right)}^{4} - \left(\left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \left(a \cdot a\right)\right) \cdot \left(\left(\sin \left(\mathsf{fma}\left(\pi, \frac{angle}{180}, \frac{\pi}{2}\right)\right) \cdot \sin \left(\mathsf{fma}\left(\pi, \frac{angle}{180}, \frac{\pi}{2}\right)\right)\right) \cdot \left(b \cdot b\right)\right)\right)}} \]
  4. Taylor expanded in angle around inf

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

    \[\leadsto \color{blue}{\frac{\mathsf{fma}\left({a}^{6}, {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{6}, {b}^{6} \cdot {\sin \left(\mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, 0.5 \cdot \pi\right)\right)}^{6}\right)}{\mathsf{fma}\left({a}^{4}, {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{4}, {b}^{4} \cdot {\sin \left(\mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, 0.5 \cdot \pi\right)\right)}^{4}\right) - \left(\left(a \cdot a\right) \cdot \left(b \cdot b\right)\right) \cdot \left(\left(\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right) \cdot \left(\sin \left(\mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, 0.5 \cdot \pi\right)\right) \cdot \sin \left(\mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, 0.5 \cdot \pi\right)\right)\right)\right)}} \]
  6. Add Preprocessing

Alternative 13: 3.6% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(\mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, 0.5 \cdot \pi\right)\right)\\ t_1 := \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\\ \frac{\mathsf{fma}\left(e^{\log a \cdot 6}, {t\_1}^{6}, {b}^{6} \cdot {t\_0}^{6}\right)}{\mathsf{fma}\left({a}^{4}, {t\_1}^{4}, {b}^{4} \cdot {t\_0}^{4}\right) - \left(\left(a \cdot a\right) \cdot \left(b \cdot b\right)\right) \cdot \left(\left(t\_1 \cdot t\_1\right) \cdot \left(t\_0 \cdot t\_0\right)\right)} \end{array} \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (let* ((t_0 (sin (fma 0.005555555555555556 (* angle PI) (* 0.5 PI))))
        (t_1 (sin (* 0.005555555555555556 (* angle PI)))))
   (/
    (fma (exp (* (log a) 6.0)) (pow t_1 6.0) (* (pow b 6.0) (pow t_0 6.0)))
    (-
     (fma (pow a 4.0) (pow t_1 4.0) (* (pow b 4.0) (pow t_0 4.0)))
     (* (* (* a a) (* b b)) (* (* t_1 t_1) (* t_0 t_0)))))))
double code(double a, double b, double angle) {
	double t_0 = sin(fma(0.005555555555555556, (angle * ((double) M_PI)), (0.5 * ((double) M_PI))));
	double t_1 = sin((0.005555555555555556 * (angle * ((double) M_PI))));
	return fma(exp((log(a) * 6.0)), pow(t_1, 6.0), (pow(b, 6.0) * pow(t_0, 6.0))) / (fma(pow(a, 4.0), pow(t_1, 4.0), (pow(b, 4.0) * pow(t_0, 4.0))) - (((a * a) * (b * b)) * ((t_1 * t_1) * (t_0 * t_0))));
}
function code(a, b, angle)
	t_0 = sin(fma(0.005555555555555556, Float64(angle * pi), Float64(0.5 * pi)))
	t_1 = sin(Float64(0.005555555555555556 * Float64(angle * pi)))
	return Float64(fma(exp(Float64(log(a) * 6.0)), (t_1 ^ 6.0), Float64((b ^ 6.0) * (t_0 ^ 6.0))) / Float64(fma((a ^ 4.0), (t_1 ^ 4.0), Float64((b ^ 4.0) * (t_0 ^ 4.0))) - Float64(Float64(Float64(a * a) * Float64(b * b)) * Float64(Float64(t_1 * t_1) * Float64(t_0 * t_0)))))
end
code[a_, b_, angle_] := Block[{t$95$0 = N[Sin[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision] + N[(0.5 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[Exp[N[(N[Log[a], $MachinePrecision] * 6.0), $MachinePrecision]], $MachinePrecision] * N[Power[t$95$1, 6.0], $MachinePrecision] + N[(N[Power[b, 6.0], $MachinePrecision] * N[Power[t$95$0, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Power[a, 4.0], $MachinePrecision] * N[Power[t$95$1, 4.0], $MachinePrecision] + N[(N[Power[b, 4.0], $MachinePrecision] * N[Power[t$95$0, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(a * a), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$1 * t$95$1), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin \left(\mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, 0.5 \cdot \pi\right)\right)\\
t_1 := \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\\
\frac{\mathsf{fma}\left(e^{\log a \cdot 6}, {t\_1}^{6}, {b}^{6} \cdot {t\_0}^{6}\right)}{\mathsf{fma}\left({a}^{4}, {t\_1}^{4}, {b}^{4} \cdot {t\_0}^{4}\right) - \left(\left(a \cdot a\right) \cdot \left(b \cdot b\right)\right) \cdot \left(\left(t\_1 \cdot t\_1\right) \cdot \left(t\_0 \cdot t\_0\right)\right)}
\end{array}
\end{array}
Derivation
  1. Initial program 80.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. Applied rewrites11.1%

    \[\leadsto \color{blue}{\frac{{\left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot a\right)}^{6}}{\mathsf{fma}\left(\left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \left(a \cdot a\right), \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \left(a \cdot a\right), {\left(\sin \left(\mathsf{fma}\left(\pi, \frac{angle}{180}, \frac{\pi}{2}\right)\right) \cdot b\right)}^{4} - \left(\left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \left(a \cdot a\right)\right) \cdot \left(\left(\sin \left(\mathsf{fma}\left(\pi, \frac{angle}{180}, \frac{\pi}{2}\right)\right) \cdot \sin \left(\mathsf{fma}\left(\pi, \frac{angle}{180}, \frac{\pi}{2}\right)\right)\right) \cdot \left(b \cdot b\right)\right)\right)} + \frac{{\left(\sin \left(\mathsf{fma}\left(\pi, \frac{angle}{180}, \frac{\pi}{2}\right)\right) \cdot b\right)}^{6}}{\mathsf{fma}\left(\left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \left(a \cdot a\right), \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \left(a \cdot a\right), {\left(\sin \left(\mathsf{fma}\left(\pi, \frac{angle}{180}, \frac{\pi}{2}\right)\right) \cdot b\right)}^{4} - \left(\left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \left(a \cdot a\right)\right) \cdot \left(\left(\sin \left(\mathsf{fma}\left(\pi, \frac{angle}{180}, \frac{\pi}{2}\right)\right) \cdot \sin \left(\mathsf{fma}\left(\pi, \frac{angle}{180}, \frac{\pi}{2}\right)\right)\right) \cdot \left(b \cdot b\right)\right)\right)}} \]
  4. Taylor expanded in angle around inf

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

    \[\leadsto \color{blue}{\frac{\mathsf{fma}\left({a}^{6}, {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{6}, {b}^{6} \cdot {\sin \left(\mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, 0.5 \cdot \pi\right)\right)}^{6}\right)}{\mathsf{fma}\left({a}^{4}, {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{4}, {b}^{4} \cdot {\sin \left(\mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, 0.5 \cdot \pi\right)\right)}^{4}\right) - \left(\left(a \cdot a\right) \cdot \left(b \cdot b\right)\right) \cdot \left(\left(\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right) \cdot \left(\sin \left(\mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, 0.5 \cdot \pi\right)\right) \cdot \sin \left(\mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, 0.5 \cdot \pi\right)\right)\right)\right)}} \]
  6. Step-by-step derivation
    1. lift-pow.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left({a}^{6}, {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right)}^{6}, {b}^{6} \cdot {\sin \left(\mathsf{fma}\left(\frac{1}{180}, angle \cdot \pi, \frac{1}{2} \cdot \pi\right)\right)}^{6}\right)}{\mathsf{fma}\left(\color{blue}{{a}^{4}}, {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right)}^{4}, {b}^{4} \cdot {\sin \left(\mathsf{fma}\left(\frac{1}{180}, angle \cdot \pi, \frac{1}{2} \cdot \pi\right)\right)}^{4}\right) - \left(\left(a \cdot a\right) \cdot \left(b \cdot b\right)\right) \cdot \left(\left(\sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right) \cdot \sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right)\right) \cdot \left(\sin \left(\mathsf{fma}\left(\frac{1}{180}, angle \cdot \pi, \frac{1}{2} \cdot \pi\right)\right) \cdot \sin \left(\mathsf{fma}\left(\frac{1}{180}, angle \cdot \pi, \frac{1}{2} \cdot \pi\right)\right)\right)\right)} \]
    2. pow-to-expN/A

      \[\leadsto \frac{\mathsf{fma}\left(e^{\log a \cdot 6}, {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right)}^{6}, {b}^{6} \cdot {\sin \left(\mathsf{fma}\left(\frac{1}{180}, angle \cdot \pi, \frac{1}{2} \cdot \pi\right)\right)}^{6}\right)}{\mathsf{fma}\left(\color{blue}{{a}^{4}}, {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right)}^{4}, {b}^{4} \cdot {\sin \left(\mathsf{fma}\left(\frac{1}{180}, angle \cdot \pi, \frac{1}{2} \cdot \pi\right)\right)}^{4}\right) - \left(\left(a \cdot a\right) \cdot \left(b \cdot b\right)\right) \cdot \left(\left(\sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right) \cdot \sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right)\right) \cdot \left(\sin \left(\mathsf{fma}\left(\frac{1}{180}, angle \cdot \pi, \frac{1}{2} \cdot \pi\right)\right) \cdot \sin \left(\mathsf{fma}\left(\frac{1}{180}, angle \cdot \pi, \frac{1}{2} \cdot \pi\right)\right)\right)\right)} \]
    3. lower-exp.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left(e^{\log a \cdot 6}, {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right)}^{6}, {b}^{6} \cdot {\sin \left(\mathsf{fma}\left(\frac{1}{180}, angle \cdot \pi, \frac{1}{2} \cdot \pi\right)\right)}^{6}\right)}{\mathsf{fma}\left(\color{blue}{{a}^{4}}, {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right)}^{4}, {b}^{4} \cdot {\sin \left(\mathsf{fma}\left(\frac{1}{180}, angle \cdot \pi, \frac{1}{2} \cdot \pi\right)\right)}^{4}\right) - \left(\left(a \cdot a\right) \cdot \left(b \cdot b\right)\right) \cdot \left(\left(\sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right) \cdot \sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right)\right) \cdot \left(\sin \left(\mathsf{fma}\left(\frac{1}{180}, angle \cdot \pi, \frac{1}{2} \cdot \pi\right)\right) \cdot \sin \left(\mathsf{fma}\left(\frac{1}{180}, angle \cdot \pi, \frac{1}{2} \cdot \pi\right)\right)\right)\right)} \]
    4. lower-*.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left(e^{\log a \cdot 6}, {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right)}^{6}, {b}^{6} \cdot {\sin \left(\mathsf{fma}\left(\frac{1}{180}, angle \cdot \pi, \frac{1}{2} \cdot \pi\right)\right)}^{6}\right)}{\mathsf{fma}\left({\color{blue}{a}}^{4}, {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right)}^{4}, {b}^{4} \cdot {\sin \left(\mathsf{fma}\left(\frac{1}{180}, angle \cdot \pi, \frac{1}{2} \cdot \pi\right)\right)}^{4}\right) - \left(\left(a \cdot a\right) \cdot \left(b \cdot b\right)\right) \cdot \left(\left(\sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right) \cdot \sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right)\right) \cdot \left(\sin \left(\mathsf{fma}\left(\frac{1}{180}, angle \cdot \pi, \frac{1}{2} \cdot \pi\right)\right) \cdot \sin \left(\mathsf{fma}\left(\frac{1}{180}, angle \cdot \pi, \frac{1}{2} \cdot \pi\right)\right)\right)\right)} \]
    5. lower-log.f644.8

      \[\leadsto \frac{\mathsf{fma}\left(e^{\log a \cdot 6}, {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{6}, {b}^{6} \cdot {\sin \left(\mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, 0.5 \cdot \pi\right)\right)}^{6}\right)}{\mathsf{fma}\left({a}^{4}, {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{4}, {b}^{4} \cdot {\sin \left(\mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, 0.5 \cdot \pi\right)\right)}^{4}\right) - \left(\left(a \cdot a\right) \cdot \left(b \cdot b\right)\right) \cdot \left(\left(\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right) \cdot \left(\sin \left(\mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, 0.5 \cdot \pi\right)\right) \cdot \sin \left(\mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, 0.5 \cdot \pi\right)\right)\right)\right)} \]
  7. Applied rewrites4.8%

    \[\leadsto \frac{\mathsf{fma}\left(e^{\log a \cdot 6}, {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{6}, {b}^{6} \cdot {\sin \left(\mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, 0.5 \cdot \pi\right)\right)}^{6}\right)}{\mathsf{fma}\left(\color{blue}{{a}^{4}}, {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{4}, {b}^{4} \cdot {\sin \left(\mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, 0.5 \cdot \pi\right)\right)}^{4}\right) - \left(\left(a \cdot a\right) \cdot \left(b \cdot b\right)\right) \cdot \left(\left(\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right) \cdot \left(\sin \left(\mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, 0.5 \cdot \pi\right)\right) \cdot \sin \left(\mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, 0.5 \cdot \pi\right)\right)\right)\right)} \]
  8. Add Preprocessing

Reproduce

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