ab-angle->ABCF C

Percentage Accurate: 79.6% → 79.6%
Time: 6.9s
Alternatives: 11
Speedup: N/A×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 11 alternatives:

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

Initial Program: 79.6% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

\\
{\left(a \cdot \sin \left(angle \cdot \mathsf{fma}\left(0.005555555555555556, \pi, 0.5 \cdot \frac{\pi}{angle}\right)\right)\right)}^{2} + {\left(\frac{1}{{\left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot b\right)}^{-1}}\right)}^{2}
\end{array}
Derivation
  1. Initial program 80.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(\frac{1}{{\left(\sin \left(\color{blue}{\pi} \cdot \frac{angle}{180}\right) \cdot b\right)}^{-1}}\right)}^{2} \]
    17. lift-sin.f6480.8

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto {\left(a \cdot \sin \left(angle \cdot \mathsf{fma}\left(0.005555555555555556, \pi, 0.5 \cdot \frac{\pi}{angle}\right)\right)\right)}^{2} + {\left(\frac{1}{{\left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot b\right)}^{-1}}\right)}^{2} \]
  12. Applied rewrites80.6%

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

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

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

\\
\begin{array}{l}
t_0 := 0.005555555555555556 \cdot \left(\pi \cdot angle\right)\\
t_1 := \sin t\_0 \cdot b\\
\mathsf{fma}\left({\sin \left(\mathsf{fma}\left(0.5, \pi, t\_0\right)\right)}^{2}, a \cdot a, t\_1 \cdot t\_1\right)
\end{array}
\end{array}
Derivation
  1. Initial program 80.8%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{{b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(e^{\log a + \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.6%

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

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

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

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

\\
\begin{array}{l}
t_0 := 0.005555555555555556 \cdot \left(\pi \cdot angle\right)\\
t_1 := \sin t\_0 \cdot b\\
t_2 := \left({\left(\frac{-1}{a}\right)}^{-1} \cdot \sin \left(\mathsf{fma}\left(0.5, \pi, t\_0\right)\right)\right) \cdot -1\\
\mathsf{fma}\left(t\_1, t\_1, t\_2 \cdot t\_2\right)
\end{array}
\end{array}
Derivation
  1. Initial program 80.8%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{{b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\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}{a}\right)\right)}\right)}^{2}} \]
  6. Applied rewrites80.5%

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

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

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

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

\\
\begin{array}{l}
t_0 := 0.005555555555555556 \cdot \left(\pi \cdot angle\right)\\
t_1 := \sin t\_0 \cdot b\\
\mathbf{if}\;a \leq 1.4 \cdot 10^{+153}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, t\_1, \left(\left({\left(\frac{-1}{a}\right)}^{-1} \cdot \sin \left(\mathsf{fma}\left(0.5, \pi, t\_0\right)\right)\right) \cdot -1\right) \cdot \left(\left(\left(-1 \cdot a\right) \cdot \sin \left(0.5 \cdot \pi\right)\right) \cdot -1\right)\right)\\

\mathbf{else}:\\
\;\;\;\;e^{\log a \cdot 2}\\


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

    1. Initial program 77.5%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\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}{a}\right)\right)}\right)}^{2}} \]
    6. Applied rewrites77.2%

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

      \[\leadsto \mathsf{fma}\left(\sin \left(\frac{1}{180} \cdot \left(\pi \cdot angle\right)\right) \cdot b, \sin \left(\frac{1}{180} \cdot \left(\pi \cdot angle\right)\right) \cdot b, \left(\left({\left(\frac{-1}{a}\right)}^{-1} \cdot \sin \left(\mathsf{fma}\left(\frac{1}{2}, \pi, \frac{1}{180} \cdot \left(\pi \cdot angle\right)\right)\right)\right) \cdot -1\right) \cdot \left(\left(-1 \cdot \left(a \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right)\right) \cdot -1\right)\right) \]
    8. Step-by-step derivation
      1. associate-*r*N/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right) \cdot b, \sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right) \cdot b, \left(\left({\left(\frac{-1}{a}\right)}^{-1} \cdot \sin \left(\mathsf{fma}\left(0.5, \pi, 0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)\right) \cdot -1\right) \cdot \left(\left(\left(-1 \cdot a\right) \cdot \sin \left(0.5 \cdot \pi\right)\right) \cdot -1\right)\right) \]
    9. Applied rewrites71.0%

      \[\leadsto \mathsf{fma}\left(\sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right) \cdot b, \sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right) \cdot b, \left(\left({\left(\frac{-1}{a}\right)}^{-1} \cdot \sin \left(\mathsf{fma}\left(0.5, \pi, 0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)\right) \cdot -1\right) \cdot \left(\left(\left(-1 \cdot a\right) \cdot \sin \left(0.5 \cdot \pi\right)\right) \cdot -1\right)\right) \]

    if 1.39999999999999993e153 < a

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto e^{\log a \cdot 2} \]
      6. lift-log.f64100.0

        \[\leadsto e^{\log a \cdot 2} \]
    7. Applied rewrites100.0%

      \[\leadsto e^{\log a \cdot 2} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification75.2%

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

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

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)\\ t_1 := \sin \left(0.5 \cdot \pi\right)\\ t_2 := t\_1 \cdot t\_1\\ t_3 := \sin \left(\mathsf{fma}\left(0.005555555555555556 \cdot angle, \pi, \frac{\pi}{2}\right)\right) \cdot a\\ t_4 := \sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right) \cdot b\\ t_5 := \sin \left(\mathsf{fma}\left(0.5, \pi, \frac{\pi}{2}\right)\right)\\ \mathbf{if}\;a \leq 1.35 \cdot 10^{-121}:\\ \;\;\;\;\mathsf{fma}\left(t\_4, t\_4, \mathsf{fma}\left(angle, \left(0.011111111111111112 \cdot \left(a \cdot a\right)\right) \cdot \left(\left(\pi \cdot t\_5\right) \cdot t\_1\right) + angle \cdot \mathsf{fma}\left(\left(a \cdot a\right) \cdot angle, \left(\left(\left(\left(\pi \cdot \pi\right) \cdot \pi\right) \cdot t\_5\right) \cdot t\_1\right) \cdot -2.2862368541380886 \cdot 10^{-7}, \left(a \cdot a\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\_5 \cdot t\_5\right)\right)\right), \left(a \cdot a\right) \cdot t\_2\right)\right)\\ \mathbf{elif}\;a \leq 6.2 \cdot 10^{+142}:\\ \;\;\;\;\mathsf{fma}\left(\frac{t\_0 \cdot t\_0}{a} \cdot \frac{b \cdot b}{a}, a \cdot a, t\_3 \cdot t\_3\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot a\\ \end{array} \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (let* ((t_0 (sin (* (* PI angle) 0.005555555555555556)))
        (t_1 (sin (* 0.5 PI)))
        (t_2 (* t_1 t_1))
        (t_3 (* (sin (fma (* 0.005555555555555556 angle) PI (/ PI 2.0))) a))
        (t_4 (* (sin (* 0.005555555555555556 (* PI angle))) b))
        (t_5 (sin (fma 0.5 PI (/ PI 2.0)))))
   (if (<= a 1.35e-121)
     (fma
      t_4
      t_4
      (fma
       angle
       (+
        (* (* 0.011111111111111112 (* a a)) (* (* PI t_5) t_1))
        (*
         angle
         (fma
          (* (* a a) angle)
          (* (* (* (* (* PI PI) PI) t_5) t_1) -2.2862368541380886e-7)
          (*
           (* a a)
           (fma
            (* -3.08641975308642e-5 (* PI PI))
            t_2
            (* (* 3.08641975308642e-5 (* PI PI)) (* t_5 t_5)))))))
       (* (* a a) t_2)))
     (if (<= a 6.2e+142)
       (fma (* (/ (* t_0 t_0) a) (/ (* b b) a)) (* a a) (* t_3 t_3))
       (* a a)))))
double code(double a, double b, double angle) {
	double t_0 = sin(((((double) M_PI) * angle) * 0.005555555555555556));
	double t_1 = sin((0.5 * ((double) M_PI)));
	double t_2 = t_1 * t_1;
	double t_3 = sin(fma((0.005555555555555556 * angle), ((double) M_PI), (((double) M_PI) / 2.0))) * a;
	double t_4 = sin((0.005555555555555556 * (((double) M_PI) * angle))) * b;
	double t_5 = sin(fma(0.5, ((double) M_PI), (((double) M_PI) / 2.0)));
	double tmp;
	if (a <= 1.35e-121) {
		tmp = fma(t_4, t_4, fma(angle, (((0.011111111111111112 * (a * a)) * ((((double) M_PI) * t_5) * t_1)) + (angle * fma(((a * a) * angle), (((((((double) M_PI) * ((double) M_PI)) * ((double) M_PI)) * t_5) * t_1) * -2.2862368541380886e-7), ((a * a) * fma((-3.08641975308642e-5 * (((double) M_PI) * ((double) M_PI))), t_2, ((3.08641975308642e-5 * (((double) M_PI) * ((double) M_PI))) * (t_5 * t_5))))))), ((a * a) * t_2)));
	} else if (a <= 6.2e+142) {
		tmp = fma((((t_0 * t_0) / a) * ((b * b) / a)), (a * a), (t_3 * t_3));
	} else {
		tmp = a * a;
	}
	return tmp;
}
function code(a, b, angle)
	t_0 = sin(Float64(Float64(pi * angle) * 0.005555555555555556))
	t_1 = sin(Float64(0.5 * pi))
	t_2 = Float64(t_1 * t_1)
	t_3 = Float64(sin(fma(Float64(0.005555555555555556 * angle), pi, Float64(pi / 2.0))) * a)
	t_4 = Float64(sin(Float64(0.005555555555555556 * Float64(pi * angle))) * b)
	t_5 = sin(fma(0.5, pi, Float64(pi / 2.0)))
	tmp = 0.0
	if (a <= 1.35e-121)
		tmp = fma(t_4, t_4, fma(angle, Float64(Float64(Float64(0.011111111111111112 * Float64(a * a)) * Float64(Float64(pi * t_5) * t_1)) + Float64(angle * fma(Float64(Float64(a * a) * angle), Float64(Float64(Float64(Float64(Float64(pi * pi) * pi) * t_5) * t_1) * -2.2862368541380886e-7), Float64(Float64(a * a) * fma(Float64(-3.08641975308642e-5 * Float64(pi * pi)), t_2, Float64(Float64(3.08641975308642e-5 * Float64(pi * pi)) * Float64(t_5 * t_5))))))), Float64(Float64(a * a) * t_2)));
	elseif (a <= 6.2e+142)
		tmp = fma(Float64(Float64(Float64(t_0 * t_0) / a) * Float64(Float64(b * b) / a)), Float64(a * a), Float64(t_3 * t_3));
	else
		tmp = Float64(a * a);
	end
	return tmp
end
code[a_, b_, angle_] := Block[{t$95$0 = N[Sin[N[(N[(Pi * angle), $MachinePrecision] * 0.005555555555555556), $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]}, Block[{t$95$3 = N[(N[Sin[N[(N[(0.005555555555555556 * angle), $MachinePrecision] * Pi + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * a), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sin[N[(0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * b), $MachinePrecision]}, Block[{t$95$5 = N[Sin[N[(0.5 * Pi + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[a, 1.35e-121], N[(t$95$4 * t$95$4 + N[(angle * N[(N[(N[(0.011111111111111112 * N[(a * a), $MachinePrecision]), $MachinePrecision] * N[(N[(Pi * t$95$5), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(angle * N[(N[(N[(a * a), $MachinePrecision] * angle), $MachinePrecision] * N[(N[(N[(N[(N[(Pi * Pi), $MachinePrecision] * Pi), $MachinePrecision] * t$95$5), $MachinePrecision] * t$95$1), $MachinePrecision] * -2.2862368541380886e-7), $MachinePrecision] + N[(N[(a * a), $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$5 * t$95$5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a * a), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 6.2e+142], N[(N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] / a), $MachinePrecision] * N[(N[(b * b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] * N[(a * a), $MachinePrecision] + N[(t$95$3 * t$95$3), $MachinePrecision]), $MachinePrecision], N[(a * a), $MachinePrecision]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)\\
t_1 := \sin \left(0.5 \cdot \pi\right)\\
t_2 := t\_1 \cdot t\_1\\
t_3 := \sin \left(\mathsf{fma}\left(0.005555555555555556 \cdot angle, \pi, \frac{\pi}{2}\right)\right) \cdot a\\
t_4 := \sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right) \cdot b\\
t_5 := \sin \left(\mathsf{fma}\left(0.5, \pi, \frac{\pi}{2}\right)\right)\\
\mathbf{if}\;a \leq 1.35 \cdot 10^{-121}:\\
\;\;\;\;\mathsf{fma}\left(t\_4, t\_4, \mathsf{fma}\left(angle, \left(0.011111111111111112 \cdot \left(a \cdot a\right)\right) \cdot \left(\left(\pi \cdot t\_5\right) \cdot t\_1\right) + angle \cdot \mathsf{fma}\left(\left(a \cdot a\right) \cdot angle, \left(\left(\left(\left(\pi \cdot \pi\right) \cdot \pi\right) \cdot t\_5\right) \cdot t\_1\right) \cdot -2.2862368541380886 \cdot 10^{-7}, \left(a \cdot a\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\_5 \cdot t\_5\right)\right)\right), \left(a \cdot a\right) \cdot t\_2\right)\right)\\

\mathbf{elif}\;a \leq 6.2 \cdot 10^{+142}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t\_0 \cdot t\_0}{a} \cdot \frac{b \cdot b}{a}, a \cdot a, t\_3 \cdot t\_3\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < 1.3500000000000001e-121

    1. Initial program 78.6%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\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}{a}\right)\right)}\right)}^{2}} \]
    6. Applied rewrites78.6%

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

      \[\leadsto \mathsf{fma}\left(\sin \left(\frac{1}{180} \cdot \left(\pi \cdot angle\right)\right) \cdot b, \sin \left(\frac{1}{180} \cdot \left(\pi \cdot angle\right)\right) \cdot b, angle \cdot \left(\frac{1}{90} \cdot \left({a}^{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({a}^{2} \cdot \left(angle \cdot \left(\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) + \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)\right)\right) + {a}^{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) + {a}^{2} \cdot {\sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)}^{2}\right) \]
    8. Applied rewrites55.7%

      \[\leadsto \mathsf{fma}\left(\sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right) \cdot b, \sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right) \cdot b, \mathsf{fma}\left(angle, \left(0.011111111111111112 \cdot \left(a \cdot a\right)\right) \cdot \left(\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)\right) + angle \cdot \mathsf{fma}\left(\left(a \cdot a\right) \cdot angle, \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(a \cdot a\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), \left(a \cdot a\right) \cdot \left(\sin \left(0.5 \cdot \pi\right) \cdot \sin \left(0.5 \cdot \pi\right)\right)\right)\right) \]

    if 1.3500000000000001e-121 < a < 6.1999999999999998e142

    1. Initial program 71.9%

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

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

        \[\leadsto \frac{{b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{a}^{2}} \cdot {a}^{2} + \color{blue}{{\cos \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 {\sin \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}{{\cos \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 {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{a}^{2}}, \color{blue}{{a}^{2}}, {a}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) \]
    5. Applied rewrites59.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\sin \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right) \cdot \sin \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)}{a} \cdot \frac{b \cdot b}{a}, a \cdot a, \left(\sin \left(\mathsf{fma}\left(0.005555555555555556 \cdot angle, \pi, \frac{\pi}{2}\right)\right) \cdot a\right) \cdot \left(\sin \left(\mathsf{fma}\left(0.005555555555555556 \cdot angle, \pi, \frac{\pi}{2}\right)\right) \cdot a\right)\right)} \]

    if 6.1999999999999998e142 < a

    1. Initial program 100.0%

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

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

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

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

      \[\leadsto \color{blue}{a \cdot a} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification63.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 1.35 \cdot 10^{-121}:\\ \;\;\;\;\mathsf{fma}\left(\sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right) \cdot b, \sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right) \cdot b, \mathsf{fma}\left(angle, \left(0.011111111111111112 \cdot \left(a \cdot a\right)\right) \cdot \left(\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)\right) + angle \cdot \mathsf{fma}\left(\left(a \cdot a\right) \cdot angle, \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(a \cdot a\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), \left(a \cdot a\right) \cdot \left(\sin \left(0.5 \cdot \pi\right) \cdot \sin \left(0.5 \cdot \pi\right)\right)\right)\right)\\ \mathbf{elif}\;a \leq 6.2 \cdot 10^{+142}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\sin \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right) \cdot \sin \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)}{a} \cdot \frac{b \cdot b}{a}, a \cdot a, \left(\sin \left(\mathsf{fma}\left(0.005555555555555556 \cdot angle, \pi, \frac{\pi}{2}\right)\right) \cdot a\right) \cdot \left(\sin \left(\mathsf{fma}\left(0.005555555555555556 \cdot angle, \pi, \frac{\pi}{2}\right)\right) \cdot a\right)\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot a\\ \end{array} \]
  5. Add Preprocessing

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

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)\\ t_1 := \sin \left(\mathsf{fma}\left(0.005555555555555556 \cdot angle, \pi, \frac{\pi}{2}\right)\right) \cdot a\\ t_2 := 0.005555555555555556 \cdot \left(\pi \cdot angle\right)\\ t_3 := \left({\left(\frac{-1}{a}\right)}^{-1} \cdot \sin \left(\mathsf{fma}\left(0.5, \pi, t\_2\right)\right)\right) \cdot -1\\ \mathbf{if}\;angle \leq 1.85 \cdot 10^{+55}:\\ \;\;\;\;\mathsf{fma}\left(\sin t\_2 \cdot b, 0.005555555555555556 \cdot \left(angle \cdot \left(b \cdot \pi\right)\right), t\_3 \cdot t\_3\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{t\_0 \cdot t\_0}{a} \cdot \frac{b \cdot b}{a}, a \cdot a, t\_1 \cdot t\_1\right)\\ \end{array} \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (let* ((t_0 (sin (* (* PI angle) 0.005555555555555556)))
        (t_1 (* (sin (fma (* 0.005555555555555556 angle) PI (/ PI 2.0))) a))
        (t_2 (* 0.005555555555555556 (* PI angle)))
        (t_3 (* (* (pow (/ -1.0 a) -1.0) (sin (fma 0.5 PI t_2))) -1.0)))
   (if (<= angle 1.85e+55)
     (fma
      (* (sin t_2) b)
      (* 0.005555555555555556 (* angle (* b PI)))
      (* t_3 t_3))
     (fma (* (/ (* t_0 t_0) a) (/ (* b b) a)) (* a a) (* t_1 t_1)))))
double code(double a, double b, double angle) {
	double t_0 = sin(((((double) M_PI) * angle) * 0.005555555555555556));
	double t_1 = sin(fma((0.005555555555555556 * angle), ((double) M_PI), (((double) M_PI) / 2.0))) * a;
	double t_2 = 0.005555555555555556 * (((double) M_PI) * angle);
	double t_3 = (pow((-1.0 / a), -1.0) * sin(fma(0.5, ((double) M_PI), t_2))) * -1.0;
	double tmp;
	if (angle <= 1.85e+55) {
		tmp = fma((sin(t_2) * b), (0.005555555555555556 * (angle * (b * ((double) M_PI)))), (t_3 * t_3));
	} else {
		tmp = fma((((t_0 * t_0) / a) * ((b * b) / a)), (a * a), (t_1 * t_1));
	}
	return tmp;
}
function code(a, b, angle)
	t_0 = sin(Float64(Float64(pi * angle) * 0.005555555555555556))
	t_1 = Float64(sin(fma(Float64(0.005555555555555556 * angle), pi, Float64(pi / 2.0))) * a)
	t_2 = Float64(0.005555555555555556 * Float64(pi * angle))
	t_3 = Float64(Float64((Float64(-1.0 / a) ^ -1.0) * sin(fma(0.5, pi, t_2))) * -1.0)
	tmp = 0.0
	if (angle <= 1.85e+55)
		tmp = fma(Float64(sin(t_2) * b), Float64(0.005555555555555556 * Float64(angle * Float64(b * pi))), Float64(t_3 * t_3));
	else
		tmp = fma(Float64(Float64(Float64(t_0 * t_0) / a) * Float64(Float64(b * b) / 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[(Pi * angle), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[N[(N[(0.005555555555555556 * angle), $MachinePrecision] * Pi + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * a), $MachinePrecision]}, Block[{t$95$2 = N[(0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Power[N[(-1.0 / a), $MachinePrecision], -1.0], $MachinePrecision] * N[Sin[N[(0.5 * Pi + t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * -1.0), $MachinePrecision]}, If[LessEqual[angle, 1.85e+55], N[(N[(N[Sin[t$95$2], $MachinePrecision] * b), $MachinePrecision] * N[(0.005555555555555556 * N[(angle * N[(b * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$3 * t$95$3), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] / a), $MachinePrecision] * N[(N[(b * b), $MachinePrecision] / a), $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(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)\\
t_1 := \sin \left(\mathsf{fma}\left(0.005555555555555556 \cdot angle, \pi, \frac{\pi}{2}\right)\right) \cdot a\\
t_2 := 0.005555555555555556 \cdot \left(\pi \cdot angle\right)\\
t_3 := \left({\left(\frac{-1}{a}\right)}^{-1} \cdot \sin \left(\mathsf{fma}\left(0.5, \pi, t\_2\right)\right)\right) \cdot -1\\
\mathbf{if}\;angle \leq 1.85 \cdot 10^{+55}:\\
\;\;\;\;\mathsf{fma}\left(\sin t\_2 \cdot b, 0.005555555555555556 \cdot \left(angle \cdot \left(b \cdot \pi\right)\right), t\_3 \cdot t\_3\right)\\

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


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

    1. Initial program 86.4%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\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}{a}\right)\right)}\right)}^{2}} \]
    6. Applied rewrites86.2%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right) \cdot b, 0.005555555555555556 \cdot \left(angle \cdot \left(b \cdot \pi\right)\right), \left(\left({\left(\frac{-1}{a}\right)}^{-1} \cdot \sin \left(\mathsf{fma}\left(0.5, \pi, 0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)\right) \cdot -1\right) \cdot \left(\left({\left(\frac{-1}{a}\right)}^{-1} \cdot \sin \left(\mathsf{fma}\left(0.5, \pi, 0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)\right) \cdot -1\right)\right) \]
    9. Applied rewrites75.3%

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

    if 1.8500000000000001e55 < angle

    1. Initial program 63.3%

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

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

        \[\leadsto \frac{{b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{a}^{2}} \cdot {a}^{2} + \color{blue}{{\cos \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 {\sin \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}{{\cos \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 {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{a}^{2}}, \color{blue}{{a}^{2}}, {a}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) \]
    5. Applied rewrites38.7%

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

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

Alternative 9: 57.1% 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) \cdot a\\ t_1 := \sin \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)\\ \mathbf{if}\;a \leq 6.2 \cdot 10^{+142}:\\ \;\;\;\;\mathsf{fma}\left(\frac{t\_1 \cdot t\_1}{a} \cdot \frac{b \cdot b}{a}, a \cdot a, t\_0 \cdot t\_0\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot a\\ \end{array} \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (let* ((t_0 (* (sin (fma (* 0.005555555555555556 angle) PI (/ PI 2.0))) a))
        (t_1 (sin (* (* PI angle) 0.005555555555555556))))
   (if (<= a 6.2e+142)
     (fma (* (/ (* t_1 t_1) a) (/ (* b b) a)) (* a a) (* t_0 t_0))
     (* a a))))
double code(double a, double b, double angle) {
	double t_0 = sin(fma((0.005555555555555556 * angle), ((double) M_PI), (((double) M_PI) / 2.0))) * a;
	double t_1 = sin(((((double) M_PI) * angle) * 0.005555555555555556));
	double tmp;
	if (a <= 6.2e+142) {
		tmp = fma((((t_1 * t_1) / a) * ((b * b) / a)), (a * a), (t_0 * t_0));
	} else {
		tmp = a * a;
	}
	return tmp;
}
function code(a, b, angle)
	t_0 = Float64(sin(fma(Float64(0.005555555555555556 * angle), pi, Float64(pi / 2.0))) * a)
	t_1 = sin(Float64(Float64(pi * angle) * 0.005555555555555556))
	tmp = 0.0
	if (a <= 6.2e+142)
		tmp = fma(Float64(Float64(Float64(t_1 * t_1) / a) * Float64(Float64(b * b) / a)), Float64(a * a), Float64(t_0 * t_0));
	else
		tmp = Float64(a * a);
	end
	return tmp
end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[Sin[N[(N[(0.005555555555555556 * angle), $MachinePrecision] * Pi + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * a), $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(N[(Pi * angle), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[a, 6.2e+142], N[(N[(N[(N[(t$95$1 * t$95$1), $MachinePrecision] / a), $MachinePrecision] * N[(N[(b * b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] * N[(a * a), $MachinePrecision] + N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision], N[(a * a), $MachinePrecision]]]]
\begin{array}{l}

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

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


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

    1. Initial program 77.0%

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

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

        \[\leadsto \frac{{b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{a}^{2}} \cdot {a}^{2} + \color{blue}{{\cos \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 {\sin \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}{{\cos \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 {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{a}^{2}}, \color{blue}{{a}^{2}}, {a}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) \]
    5. Applied rewrites47.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\sin \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right) \cdot \sin \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)}{a} \cdot \frac{b \cdot b}{a}, a \cdot a, \left(\sin \left(\mathsf{fma}\left(0.005555555555555556 \cdot angle, \pi, \frac{\pi}{2}\right)\right) \cdot a\right) \cdot \left(\sin \left(\mathsf{fma}\left(0.005555555555555556 \cdot angle, \pi, \frac{\pi}{2}\right)\right) \cdot a\right)\right)} \]

    if 6.1999999999999998e142 < a

    1. Initial program 100.0%

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

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

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

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

      \[\leadsto \color{blue}{a \cdot a} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 10: 53.6% accurate, N/A× speedup?

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

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

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

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

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

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

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

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

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

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

\[\begin{array}{l} \\ e^{\log a \cdot 2} \end{array} \]
(FPCore (a b angle) :precision binary64 (exp (* (log a) 2.0)))
double code(double a, double b, double angle) {
	return exp((log(a) * 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(a) * 2.0d0))
end function
public static double code(double a, double b, double angle) {
	return Math.exp((Math.log(a) * 2.0));
}
def code(a, b, angle):
	return math.exp((math.log(a) * 2.0))
function code(a, b, angle)
	return exp(Float64(log(a) * 2.0))
end
function tmp = code(a, b, angle)
	tmp = exp((log(a) * 2.0));
end
code[a_, b_, angle_] := N[Exp[N[(N[Log[a], $MachinePrecision] * 2.0), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
e^{\log a \cdot 2}
\end{array}
Derivation
  1. Initial program 80.8%

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

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

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

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

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

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

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

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

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

      \[\leadsto e^{\log a \cdot 2} \]
    6. lift-log.f6429.8

      \[\leadsto e^{\log a \cdot 2} \]
  7. Applied rewrites29.8%

    \[\leadsto e^{\log a \cdot 2} \]
  8. Add Preprocessing

Reproduce

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