ab-angle->ABCF C

Percentage Accurate: 79.4% → 79.4%
Time: 34.8s
Alternatives: 6
Speedup: 1.5×

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 6 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.4% 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.4% accurate, 0.8× speedup?

\[\begin{array}{l} angle = |angle|\\ \\ {a}^{2} + {\left(b \cdot \sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\pi \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(angle \cdot 0.005555555555555556\right)\right)\right)\right)\right)\right)}^{2} \end{array} \]
NOTE: angle should be positive before calling this function
(FPCore (a b angle)
 :precision binary64
 (+
  (pow a 2.0)
  (pow
   (*
    b
    (sin
     (expm1 (log1p (* PI (expm1 (log1p (* angle 0.005555555555555556))))))))
   2.0)))
angle = abs(angle);
double code(double a, double b, double angle) {
	return pow(a, 2.0) + pow((b * sin(expm1(log1p((((double) M_PI) * expm1(log1p((angle * 0.005555555555555556)))))))), 2.0);
}
angle = Math.abs(angle);
public static double code(double a, double b, double angle) {
	return Math.pow(a, 2.0) + Math.pow((b * Math.sin(Math.expm1(Math.log1p((Math.PI * Math.expm1(Math.log1p((angle * 0.005555555555555556)))))))), 2.0);
}
angle = abs(angle)
def code(a, b, angle):
	return math.pow(a, 2.0) + math.pow((b * math.sin(math.expm1(math.log1p((math.pi * math.expm1(math.log1p((angle * 0.005555555555555556)))))))), 2.0)
angle = abs(angle)
function code(a, b, angle)
	return Float64((a ^ 2.0) + (Float64(b * sin(expm1(log1p(Float64(pi * expm1(log1p(Float64(angle * 0.005555555555555556)))))))) ^ 2.0))
end
NOTE: angle should be positive before calling this function
code[a_, b_, angle_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(Exp[N[Log[1 + N[(Pi * N[(Exp[N[Log[1 + N[(angle * 0.005555555555555556), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle = |angle|\\
\\
{a}^{2} + {\left(b \cdot \sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\pi \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(angle \cdot 0.005555555555555556\right)\right)\right)\right)\right)\right)}^{2}
\end{array}
Derivation
  1. Initial program 76.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. Taylor expanded in angle around 0 76.9%

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

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

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

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

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

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

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \left(\sqrt{\frac{\left(\pi \cdot angle\right) \cdot \left(\pi \cdot angle\right)}{\color{blue}{32400}}}\right)\right)}^{2} \]
    7. metadata-eval60.5%

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

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

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

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

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\sqrt{\frac{\pi}{-180} \cdot angle} \cdot \sqrt{\frac{\pi}{-180} \cdot angle}\right)}\right)}^{2} \]
    12. add-sqr-sqrt77.0%

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\frac{\pi}{-180} \cdot angle\right)}\right)}^{2} \]
    13. expm1-log1p-u63.9%

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

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{\sqrt{\frac{\pi}{-180} \cdot angle} \cdot \sqrt{\frac{\pi}{-180} \cdot angle}}\right)\right)\right)\right)}^{2} \]
    15. sqrt-unprod60.7%

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

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

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{\pi \cdot angle}{-180} \cdot \color{blue}{\frac{\pi \cdot angle}{-180}}}\right)\right)\right)\right)}^{2} \]
    18. frac-times60.6%

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

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

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

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

    \[\leadsto {a}^{2} + {\left(b \cdot \sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\pi \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(angle \cdot 0.005555555555555556\right)\right)\right)\right)\right)\right)}^{2} \]

Alternative 2: 79.4% accurate, 1.0× speedup?

\[\begin{array}{l} angle = |angle|\\ \\ {a}^{2} + {\left(b \cdot \sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)\right)}^{2} \end{array} \]
NOTE: angle should be positive before calling this function
(FPCore (a b angle)
 :precision binary64
 (+
  (pow a 2.0)
  (pow (* b (sin (expm1 (log1p (* PI (* angle 0.005555555555555556)))))) 2.0)))
angle = abs(angle);
double code(double a, double b, double angle) {
	return pow(a, 2.0) + pow((b * sin(expm1(log1p((((double) M_PI) * (angle * 0.005555555555555556)))))), 2.0);
}
angle = Math.abs(angle);
public static double code(double a, double b, double angle) {
	return Math.pow(a, 2.0) + Math.pow((b * Math.sin(Math.expm1(Math.log1p((Math.PI * (angle * 0.005555555555555556)))))), 2.0);
}
angle = abs(angle)
def code(a, b, angle):
	return math.pow(a, 2.0) + math.pow((b * math.sin(math.expm1(math.log1p((math.pi * (angle * 0.005555555555555556)))))), 2.0)
angle = abs(angle)
function code(a, b, angle)
	return Float64((a ^ 2.0) + (Float64(b * sin(expm1(log1p(Float64(pi * Float64(angle * 0.005555555555555556)))))) ^ 2.0))
end
NOTE: angle should be positive before calling this function
code[a_, b_, angle_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(Exp[N[Log[1 + N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle = |angle|\\
\\
{a}^{2} + {\left(b \cdot \sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)\right)}^{2}
\end{array}
Derivation
  1. Initial program 76.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. Taylor expanded in angle around 0 76.9%

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

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

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

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

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

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

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \left(\sqrt{\frac{\left(\pi \cdot angle\right) \cdot \left(\pi \cdot angle\right)}{\color{blue}{32400}}}\right)\right)}^{2} \]
    7. metadata-eval60.5%

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

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

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

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

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\sqrt{\frac{\pi}{-180} \cdot angle} \cdot \sqrt{\frac{\pi}{-180} \cdot angle}\right)}\right)}^{2} \]
    12. add-sqr-sqrt77.0%

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\frac{\pi}{-180} \cdot angle\right)}\right)}^{2} \]
    13. expm1-log1p-u63.9%

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

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{\sqrt{\frac{\pi}{-180} \cdot angle} \cdot \sqrt{\frac{\pi}{-180} \cdot angle}}\right)\right)\right)\right)}^{2} \]
    15. sqrt-unprod60.7%

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

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

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{\pi \cdot angle}{-180} \cdot \color{blue}{\frac{\pi \cdot angle}{-180}}}\right)\right)\right)\right)}^{2} \]
    18. frac-times60.6%

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

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

    \[\leadsto {a}^{2} + {\left(b \cdot \sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)\right)}^{2} \]

Alternative 3: 79.4% accurate, 1.5× speedup?

\[\begin{array}{l} angle = |angle|\\ \\ {a}^{2} + {\left(b \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} \end{array} \]
NOTE: angle should be positive before calling this function
(FPCore (a b angle)
 :precision binary64
 (+ (pow a 2.0) (pow (* b (sin (* angle (/ PI 180.0)))) 2.0)))
angle = abs(angle);
double code(double a, double b, double angle) {
	return pow(a, 2.0) + pow((b * sin((angle * (((double) M_PI) / 180.0)))), 2.0);
}
angle = Math.abs(angle);
public static double code(double a, double b, double angle) {
	return Math.pow(a, 2.0) + Math.pow((b * Math.sin((angle * (Math.PI / 180.0)))), 2.0);
}
angle = abs(angle)
def code(a, b, angle):
	return math.pow(a, 2.0) + math.pow((b * math.sin((angle * (math.pi / 180.0)))), 2.0)
angle = abs(angle)
function code(a, b, angle)
	return Float64((a ^ 2.0) + (Float64(b * sin(Float64(angle * Float64(pi / 180.0)))) ^ 2.0))
end
angle = abs(angle)
function tmp = code(a, b, angle)
	tmp = (a ^ 2.0) + ((b * sin((angle * (pi / 180.0)))) ^ 2.0);
end
NOTE: angle should be positive before calling this function
code[a_, b_, angle_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(angle * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle = |angle|\\
\\
{a}^{2} + {\left(b \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2}
\end{array}
Derivation
  1. Initial program 76.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. Taylor expanded in angle around 0 76.9%

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

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

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

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\right)}\right)}^{2} \]
    3. metadata-eval77.0%

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

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

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

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

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

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

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

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

Alternative 4: 66.6% accurate, 2.0× speedup?

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

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


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

    1. Initial program 75.2%

      \[{\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
    2. Applied egg-rr59.7%

      \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + \color{blue}{\frac{{b}^{2} \cdot \left(\cos \left(\left(\pi \cdot angle\right) \cdot 0\right) - \cos \left(\left(\pi \cdot angle\right) \cdot 0\right)\right)}{2}} \]
    3. Step-by-step derivation
      1. *-commutative59.7%

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

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

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

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

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

      \[\leadsto {\color{blue}{a}}^{2} + 0 \]

    if 9.19999999999999987e-68 < b

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 9.2 \cdot 10^{-68}:\\ \;\;\;\;{a}^{2}\\ \mathbf{else}:\\ \;\;\;\;{a}^{2} + {\left(b \cdot \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)}^{2}\\ \end{array} \]

Alternative 5: 66.6% accurate, 2.0× speedup?

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

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


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

    1. Initial program 75.2%

      \[{\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
    2. Applied egg-rr59.7%

      \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + \color{blue}{\frac{{b}^{2} \cdot \left(\cos \left(\left(\pi \cdot angle\right) \cdot 0\right) - \cos \left(\left(\pi \cdot angle\right) \cdot 0\right)\right)}{2}} \]
    3. Step-by-step derivation
      1. *-commutative59.7%

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

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

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

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

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

      \[\leadsto {\color{blue}{a}}^{2} + 0 \]

    if 2.5999999999999999e-67 < b

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

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

      \[\leadsto {\left(a \cdot 1\right)}^{2} + {\left(b \cdot \color{blue}{\left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}\right)}^{2} \]
    4. Step-by-step derivation
      1. associate-*r*77.2%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 2.6 \cdot 10^{-67}:\\ \;\;\;\;{a}^{2}\\ \mathbf{else}:\\ \;\;\;\;{a}^{2} + {\left(b \cdot \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}\\ \end{array} \]

Alternative 6: 56.4% accurate, 6.0× speedup?

\[\begin{array}{l} angle = |angle|\\ \\ {a}^{2} \end{array} \]
NOTE: angle should be positive before calling this function
(FPCore (a b angle) :precision binary64 (pow a 2.0))
angle = abs(angle);
double code(double a, double b, double angle) {
	return pow(a, 2.0);
}
NOTE: angle should be positive before calling this function
real(8) function code(a, b, angle)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: angle
    code = a ** 2.0d0
end function
angle = Math.abs(angle);
public static double code(double a, double b, double angle) {
	return Math.pow(a, 2.0);
}
angle = abs(angle)
def code(a, b, angle):
	return math.pow(a, 2.0)
angle = abs(angle)
function code(a, b, angle)
	return a ^ 2.0
end
angle = abs(angle)
function tmp = code(a, b, angle)
	tmp = a ^ 2.0;
end
NOTE: angle should be positive before calling this function
code[a_, b_, angle_] := N[Power[a, 2.0], $MachinePrecision]
\begin{array}{l}
angle = |angle|\\
\\
{a}^{2}
\end{array}
Derivation
  1. Initial program 76.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. Applied egg-rr51.3%

    \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + \color{blue}{\frac{{b}^{2} \cdot \left(\cos \left(\left(\pi \cdot angle\right) \cdot 0\right) - \cos \left(\left(\pi \cdot angle\right) \cdot 0\right)\right)}{2}} \]
  3. Step-by-step derivation
    1. *-commutative51.3%

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

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

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

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

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

    \[\leadsto {\color{blue}{a}}^{2} + 0 \]
  6. Final simplification58.9%

    \[\leadsto {a}^{2} \]

Reproduce

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