ab-angle->ABCF A

Percentage Accurate: 79.6% → 79.6%
Time: 15.9s
Alternatives: 7
Speedup: N/A×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 7 alternatives:

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

Initial Program: 79.6% accurate, 1.0× speedup?

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

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

Alternative 1: 79.6% accurate, 0.7× speedup?

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

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

    \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. *-commutative77.7%

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

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

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

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

      \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{angle}{180} \cdot \pi\right)\right)\right)}\right)}^{2} \]
    2. expm1-undefine64.0%

      \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{angle}{180} \cdot \pi\right)} - 1\right)}\right)}^{2} \]
    3. associate-*l/64.0%

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

      \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \left(e^{\mathsf{log1p}\left(\color{blue}{angle \cdot \frac{\pi}{180}}\right)} - 1\right)\right)}^{2} \]
    5. div-inv64.0%

      \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \left(e^{\mathsf{log1p}\left(angle \cdot \color{blue}{\left(\pi \cdot \frac{1}{180}\right)}\right)} - 1\right)\right)}^{2} \]
    6. metadata-eval64.0%

      \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \left(e^{\mathsf{log1p}\left(angle \cdot \left(\pi \cdot \color{blue}{0.005555555555555556}\right)\right)} - 1\right)\right)}^{2} \]
  6. Applied egg-rr64.0%

    \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \color{blue}{\left(e^{\mathsf{log1p}\left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)} - 1\right)}\right)}^{2} \]
  7. Step-by-step derivation
    1. expm1-define64.1%

      \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right)}\right)}^{2} \]
    2. associate-*r*64.1%

      \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{\left(angle \cdot \pi\right) \cdot 0.005555555555555556}\right)\right)\right)\right)}^{2} \]
    3. *-commutative64.1%

      \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{0.005555555555555556 \cdot \left(angle \cdot \pi\right)}\right)\right)\right)\right)}^{2} \]
    4. associate-*r*64.1%

      \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{\left(0.005555555555555556 \cdot angle\right) \cdot \pi}\right)\right)\right)\right)}^{2} \]
  8. Simplified64.1%

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

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

Alternative 2: 79.6% accurate, 1.3× speedup?

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

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

    \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. *-commutative77.7%

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

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

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

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

      \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{angle}{180} \cdot \pi\right)\right)\right)}\right)}^{2} \]
    2. expm1-undefine64.0%

      \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{angle}{180} \cdot \pi\right)} - 1\right)}\right)}^{2} \]
    3. associate-*l/64.0%

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

      \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \left(e^{\mathsf{log1p}\left(\color{blue}{angle \cdot \frac{\pi}{180}}\right)} - 1\right)\right)}^{2} \]
    5. div-inv64.0%

      \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \left(e^{\mathsf{log1p}\left(angle \cdot \color{blue}{\left(\pi \cdot \frac{1}{180}\right)}\right)} - 1\right)\right)}^{2} \]
    6. metadata-eval64.0%

      \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \left(e^{\mathsf{log1p}\left(angle \cdot \left(\pi \cdot \color{blue}{0.005555555555555556}\right)\right)} - 1\right)\right)}^{2} \]
  6. Applied egg-rr64.0%

    \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \color{blue}{\left(e^{\mathsf{log1p}\left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)} - 1\right)}\right)}^{2} \]
  7. Step-by-step derivation
    1. expm1-define64.1%

      \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right)}\right)}^{2} \]
    2. associate-*r*64.1%

      \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{\left(angle \cdot \pi\right) \cdot 0.005555555555555556}\right)\right)\right)\right)}^{2} \]
    3. *-commutative64.1%

      \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{0.005555555555555556 \cdot \left(angle \cdot \pi\right)}\right)\right)\right)\right)}^{2} \]
    4. associate-*r*64.1%

      \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{\left(0.005555555555555556 \cdot angle\right) \cdot \pi}\right)\right)\right)\right)}^{2} \]
  8. Simplified64.1%

    \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\left(0.005555555555555556 \cdot angle\right) \cdot \pi\right)\right)\right)}\right)}^{2} \]
  9. Taylor expanded in angle around 0 77.9%

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

Alternative 3: 79.6% accurate, 1.3× speedup?

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

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

    \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. *-commutative77.7%

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

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

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

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

      \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{angle}{180} \cdot \pi\right)\right)\right)}\right)}^{2} \]
    2. expm1-undefine64.0%

      \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{angle}{180} \cdot \pi\right)} - 1\right)}\right)}^{2} \]
    3. associate-*l/64.0%

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

      \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \left(e^{\mathsf{log1p}\left(\color{blue}{angle \cdot \frac{\pi}{180}}\right)} - 1\right)\right)}^{2} \]
    5. div-inv64.0%

      \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \left(e^{\mathsf{log1p}\left(angle \cdot \color{blue}{\left(\pi \cdot \frac{1}{180}\right)}\right)} - 1\right)\right)}^{2} \]
    6. metadata-eval64.0%

      \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \left(e^{\mathsf{log1p}\left(angle \cdot \left(\pi \cdot \color{blue}{0.005555555555555556}\right)\right)} - 1\right)\right)}^{2} \]
  6. Applied egg-rr64.0%

    \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \color{blue}{\left(e^{\mathsf{log1p}\left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)} - 1\right)}\right)}^{2} \]
  7. Step-by-step derivation
    1. expm1-define64.1%

      \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right)}\right)}^{2} \]
    2. associate-*r*64.1%

      \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{\left(angle \cdot \pi\right) \cdot 0.005555555555555556}\right)\right)\right)\right)}^{2} \]
    3. *-commutative64.1%

      \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{0.005555555555555556 \cdot \left(angle \cdot \pi\right)}\right)\right)\right)\right)}^{2} \]
    4. associate-*r*64.1%

      \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{\left(0.005555555555555556 \cdot angle\right) \cdot \pi}\right)\right)\right)\right)}^{2} \]
  8. Simplified64.1%

    \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\left(0.005555555555555556 \cdot angle\right) \cdot \pi\right)\right)\right)}\right)}^{2} \]
  9. Taylor expanded in angle around 0 77.9%

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

    \[\leadsto \color{blue}{{a}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} + {b}^{2}} \]
  11. Step-by-step derivation
    1. +-commutative70.9%

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

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

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

      \[\leadsto b \cdot b + \left(a \cdot a\right) \cdot \color{blue}{\left(\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)} \]
    5. swap-sqr77.7%

      \[\leadsto b \cdot b + \color{blue}{\left(a \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right) \cdot \left(a \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)} \]
    6. unpow277.7%

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

      \[\leadsto b \cdot b + {\left(a \cdot \sin \left(0.005555555555555556 \cdot \color{blue}{\left(\pi \cdot angle\right)}\right)\right)}^{2} \]
    8. *-commutative77.7%

      \[\leadsto b \cdot b + {\left(a \cdot \sin \color{blue}{\left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)}\right)}^{2} \]
    9. associate-*r*77.8%

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

      \[\leadsto b \cdot b + \color{blue}{\left(a \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right) \cdot \left(a \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)} \]
    11. rem-square-sqrt77.8%

      \[\leadsto \color{blue}{\sqrt{b \cdot b + \left(a \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right) \cdot \left(a \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)} \cdot \sqrt{b \cdot b + \left(a \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right) \cdot \left(a \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}} \]
  12. Simplified77.8%

    \[\leadsto \color{blue}{{\left(\mathsf{hypot}\left(b, a \cdot \sin \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)\right)}^{2}} \]
  13. Final simplification77.8%

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

Alternative 4: 58.4% accurate, 1.9× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ \begin{array}{l} t_0 := 0.005555555555555556 \cdot \left(\pi \cdot angle\_m\right)\\ \mathbf{if}\;b \leq 1.2 \cdot 10^{-153}:\\ \;\;\;\;{\left(a \cdot \sin t\_0\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;{b}^{2} + {\left(a \cdot t\_0\right)}^{2}\\ \end{array} \end{array} \]
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
 :precision binary64
 (let* ((t_0 (* 0.005555555555555556 (* PI angle_m))))
   (if (<= b 1.2e-153)
     (pow (* a (sin t_0)) 2.0)
     (+ (pow b 2.0) (pow (* a t_0) 2.0)))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
	double t_0 = 0.005555555555555556 * (((double) M_PI) * angle_m);
	double tmp;
	if (b <= 1.2e-153) {
		tmp = pow((a * sin(t_0)), 2.0);
	} else {
		tmp = pow(b, 2.0) + pow((a * t_0), 2.0);
	}
	return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
	double t_0 = 0.005555555555555556 * (Math.PI * angle_m);
	double tmp;
	if (b <= 1.2e-153) {
		tmp = Math.pow((a * Math.sin(t_0)), 2.0);
	} else {
		tmp = Math.pow(b, 2.0) + Math.pow((a * t_0), 2.0);
	}
	return tmp;
}
angle_m = math.fabs(angle)
def code(a, b, angle_m):
	t_0 = 0.005555555555555556 * (math.pi * angle_m)
	tmp = 0
	if b <= 1.2e-153:
		tmp = math.pow((a * math.sin(t_0)), 2.0)
	else:
		tmp = math.pow(b, 2.0) + math.pow((a * t_0), 2.0)
	return tmp
angle_m = abs(angle)
function code(a, b, angle_m)
	t_0 = Float64(0.005555555555555556 * Float64(pi * angle_m))
	tmp = 0.0
	if (b <= 1.2e-153)
		tmp = Float64(a * sin(t_0)) ^ 2.0;
	else
		tmp = Float64((b ^ 2.0) + (Float64(a * t_0) ^ 2.0));
	end
	return tmp
end
angle_m = abs(angle);
function tmp_2 = code(a, b, angle_m)
	t_0 = 0.005555555555555556 * (pi * angle_m);
	tmp = 0.0;
	if (b <= 1.2e-153)
		tmp = (a * sin(t_0)) ^ 2.0;
	else
		tmp = (b ^ 2.0) + ((a * t_0) ^ 2.0);
	end
	tmp_2 = tmp;
end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[(0.005555555555555556 * N[(Pi * angle$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 1.2e-153], N[Power[N[(a * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(N[Power[b, 2.0], $MachinePrecision] + N[Power[N[(a * t$95$0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
angle_m = \left|angle\right|

\\
\begin{array}{l}
t_0 := 0.005555555555555556 \cdot \left(\pi \cdot angle\_m\right)\\
\mathbf{if}\;b \leq 1.2 \cdot 10^{-153}:\\
\;\;\;\;{\left(a \cdot \sin t\_0\right)}^{2}\\

\mathbf{else}:\\
\;\;\;\;{b}^{2} + {\left(a \cdot t\_0\right)}^{2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 1.2000000000000001e-153

    1. Initial program 76.4%

      \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
    2. Step-by-step derivation
      1. unpow276.4%

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

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

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

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

      \[\leadsto \color{blue}{{\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2}} \]
    4. Add Preprocessing
    5. Taylor expanded in a around inf 39.0%

      \[\leadsto \color{blue}{{a}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}} \]
    6. Step-by-step derivation
      1. unpow239.0%

        \[\leadsto \color{blue}{\left(a \cdot a\right)} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} \]
      2. *-commutative39.0%

        \[\leadsto \left(a \cdot a\right) \cdot {\sin \color{blue}{\left(\left(angle \cdot \pi\right) \cdot 0.005555555555555556\right)}}^{2} \]
      3. associate-*r*39.0%

        \[\leadsto \left(a \cdot a\right) \cdot {\sin \color{blue}{\left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)}}^{2} \]
      4. unpow239.0%

        \[\leadsto \left(a \cdot a\right) \cdot \color{blue}{\left(\sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right) \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)} \]
      5. swap-sqr44.7%

        \[\leadsto \color{blue}{\left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right) \cdot \left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)} \]
      6. unpow244.7%

        \[\leadsto \color{blue}{{\left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}} \]
      7. associate-*r*44.8%

        \[\leadsto {\left(a \cdot \sin \color{blue}{\left(\left(angle \cdot \pi\right) \cdot 0.005555555555555556\right)}\right)}^{2} \]
      8. *-commutative44.8%

        \[\leadsto {\left(a \cdot \sin \color{blue}{\left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}\right)}^{2} \]
    7. Simplified44.8%

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

    if 1.2000000000000001e-153 < b

    1. Initial program 80.1%

      \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative80.1%

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

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

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

      \[\leadsto {\left(a \cdot \sin \color{blue}{\left(\frac{\pi}{\frac{180}{angle}}\right)}\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
    5. Step-by-step derivation
      1. expm1-log1p-u61.9%

        \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{angle}{180} \cdot \pi\right)\right)\right)}\right)}^{2} \]
      2. expm1-undefine61.8%

        \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{angle}{180} \cdot \pi\right)} - 1\right)}\right)}^{2} \]
      3. associate-*l/61.8%

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

        \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \left(e^{\mathsf{log1p}\left(\color{blue}{angle \cdot \frac{\pi}{180}}\right)} - 1\right)\right)}^{2} \]
      5. div-inv61.8%

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

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

      \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \color{blue}{\left(e^{\mathsf{log1p}\left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)} - 1\right)}\right)}^{2} \]
    7. Step-by-step derivation
      1. expm1-define61.9%

        \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right)}\right)}^{2} \]
      2. associate-*r*61.9%

        \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{\left(angle \cdot \pi\right) \cdot 0.005555555555555556}\right)\right)\right)\right)}^{2} \]
      3. *-commutative61.9%

        \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{0.005555555555555556 \cdot \left(angle \cdot \pi\right)}\right)\right)\right)\right)}^{2} \]
      4. associate-*r*61.9%

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

      \[\leadsto {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\left(0.005555555555555556 \cdot angle\right) \cdot \pi\right)\right)\right)}\right)}^{2} \]
    9. Taylor expanded in angle around 0 80.9%

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

      \[\leadsto {\left(a \cdot \color{blue}{\left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}\right)}^{2} + {b}^{2} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification56.0%

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

Alternative 5: 62.6% accurate, 2.0× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;{\left(a \cdot \sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\_m\right)\right)\right)}^{2}\\


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

    1. Initial program 74.7%

      \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
    2. Step-by-step derivation
      1. unpow274.7%

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

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

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

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

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

      \[\leadsto \color{blue}{{b}^{2}} \]
    6. Step-by-step derivation
      1. unpow262.8%

        \[\leadsto \color{blue}{b \cdot b} \]
    7. Applied egg-rr62.8%

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

    if 1.6499999999999999e155 < a

    1. Initial program 99.8%

      \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
    2. Step-by-step derivation
      1. unpow299.8%

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

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

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

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

      \[\leadsto \color{blue}{{\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2}} \]
    4. Add Preprocessing
    5. Taylor expanded in a around inf 80.2%

      \[\leadsto \color{blue}{{a}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}} \]
    6. Step-by-step derivation
      1. unpow280.2%

        \[\leadsto \color{blue}{\left(a \cdot a\right)} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} \]
      2. *-commutative80.2%

        \[\leadsto \left(a \cdot a\right) \cdot {\sin \color{blue}{\left(\left(angle \cdot \pi\right) \cdot 0.005555555555555556\right)}}^{2} \]
      3. associate-*r*80.2%

        \[\leadsto \left(a \cdot a\right) \cdot {\sin \color{blue}{\left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)}}^{2} \]
      4. unpow280.2%

        \[\leadsto \left(a \cdot a\right) \cdot \color{blue}{\left(\sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right) \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)} \]
      5. swap-sqr94.9%

        \[\leadsto \color{blue}{\left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right) \cdot \left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)} \]
      6. unpow294.9%

        \[\leadsto \color{blue}{{\left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}} \]
      7. associate-*r*94.9%

        \[\leadsto {\left(a \cdot \sin \color{blue}{\left(\left(angle \cdot \pi\right) \cdot 0.005555555555555556\right)}\right)}^{2} \]
      8. *-commutative94.9%

        \[\leadsto {\left(a \cdot \sin \color{blue}{\left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}\right)}^{2} \]
    7. Simplified94.9%

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

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

Alternative 6: 57.3% accurate, 2.0× speedup?

\[\begin{array}{l} angle_m = \left|angle\right| \\ \begin{array}{l} \mathbf{if}\;a \leq 3.85 \cdot 10^{+155}:\\ \;\;\;\;b \cdot b\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{{b}^{6}}\\ \end{array} \end{array} \]
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
 :precision binary64
 (if (<= a 3.85e+155) (* b b) (cbrt (pow b 6.0))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
	double tmp;
	if (a <= 3.85e+155) {
		tmp = b * b;
	} else {
		tmp = cbrt(pow(b, 6.0));
	}
	return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
	double tmp;
	if (a <= 3.85e+155) {
		tmp = b * b;
	} else {
		tmp = Math.cbrt(Math.pow(b, 6.0));
	}
	return tmp;
}
angle_m = abs(angle)
function code(a, b, angle_m)
	tmp = 0.0
	if (a <= 3.85e+155)
		tmp = Float64(b * b);
	else
		tmp = cbrt((b ^ 6.0));
	end
	return tmp
end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := If[LessEqual[a, 3.85e+155], N[(b * b), $MachinePrecision], N[Power[N[Power[b, 6.0], $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|

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

\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{b}^{6}}\\


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

    1. Initial program 74.8%

      \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
    2. Step-by-step derivation
      1. unpow274.8%

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

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

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

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

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

      \[\leadsto \color{blue}{{b}^{2}} \]
    6. Step-by-step derivation
      1. unpow262.5%

        \[\leadsto \color{blue}{b \cdot b} \]
    7. Applied egg-rr62.5%

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

    if 3.8500000000000002e155 < a

    1. Initial program 99.8%

      \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative99.8%

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

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

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

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

      \[\leadsto \color{blue}{\sqrt[3]{{\left({\left(\mathsf{hypot}\left(b \cdot \cos \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right), a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right)}^{2}\right)}^{3}}} \]
    6. Taylor expanded in angle around 0 26.5%

      \[\leadsto \sqrt[3]{\color{blue}{{b}^{6}}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 7: 56.7% accurate, 139.0× speedup?

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

\\
b \cdot b
\end{array}
Derivation
  1. Initial program 77.7%

    \[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
  2. Step-by-step derivation
    1. unpow277.7%

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

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

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

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

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

    \[\leadsto \color{blue}{{b}^{2}} \]
  6. Step-by-step derivation
    1. unpow257.0%

      \[\leadsto \color{blue}{b \cdot b} \]
  7. Applied egg-rr57.0%

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

Reproduce

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