
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (/ angle 180.0)))) (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin t_0)) (cos t_0))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle / 180.0);
return ((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * sin(t_0)) * cos(t_0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (angle / 180.0);
return ((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * Math.sin(t_0)) * Math.cos(t_0);
}
def code(a, b, angle): t_0 = math.pi * (angle / 180.0) return ((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * math.sin(t_0)) * math.cos(t_0)
function code(a, b, angle) t_0 = Float64(pi * Float64(angle / 180.0)) return Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * sin(t_0)) * cos(t_0)) end
function tmp = code(a, b, angle) t_0 = pi * (angle / 180.0); tmp = ((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * sin(t_0)) * cos(t_0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin t\_0\right) \cdot \cos t\_0
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (/ angle 180.0)))) (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin t_0)) (cos t_0))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle / 180.0);
return ((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * sin(t_0)) * cos(t_0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (angle / 180.0);
return ((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * Math.sin(t_0)) * Math.cos(t_0);
}
def code(a, b, angle): t_0 = math.pi * (angle / 180.0) return ((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * math.sin(t_0)) * math.cos(t_0)
function code(a, b, angle) t_0 = Float64(pi * Float64(angle / 180.0)) return Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * sin(t_0)) * cos(t_0)) end
function tmp = code(a, b, angle) t_0 = pi * (angle / 180.0); tmp = ((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * sin(t_0)) * cos(t_0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin t\_0\right) \cdot \cos t\_0
\end{array}
\end{array}
a_m = (fabs.f64 a)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a_m b angle_m)
:precision binary64
(let* ((t_0 (* angle_m (sqrt PI))))
(*
angle_s
(if (<= a_m 1.9e-92)
(*
(*
(+ a_m b)
(* (- b a_m) (* 2.0 (sin (* PI (* angle_m 0.005555555555555556))))))
(cos (* (/ (sqrt PI) 180.0) (pow (pow (exp -1.0) -1.0) (log t_0)))))
(if (<= a_m 1.5e+204)
(*
(*
(+ a_m b)
(* (- b a_m) (* 2.0 (sin (/ 1.0 (/ (/ 180.0 (sqrt PI)) t_0))))))
(cos (/ (* PI angle_m) 180.0)))
(*
(+ a_m b)
(* (- b a_m) (sin (* (* (sqrt PI) t_0) 0.011111111111111112)))))))))a_m = fabs(a);
angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a_m, double b, double angle_m) {
double t_0 = angle_m * sqrt(((double) M_PI));
double tmp;
if (a_m <= 1.9e-92) {
tmp = ((a_m + b) * ((b - a_m) * (2.0 * sin((((double) M_PI) * (angle_m * 0.005555555555555556)))))) * cos(((sqrt(((double) M_PI)) / 180.0) * pow(pow(exp(-1.0), -1.0), log(t_0))));
} else if (a_m <= 1.5e+204) {
tmp = ((a_m + b) * ((b - a_m) * (2.0 * sin((1.0 / ((180.0 / sqrt(((double) M_PI))) / t_0)))))) * cos(((((double) M_PI) * angle_m) / 180.0));
} else {
tmp = (a_m + b) * ((b - a_m) * sin(((sqrt(((double) M_PI)) * t_0) * 0.011111111111111112)));
}
return angle_s * tmp;
}
a_m = Math.abs(a);
angle\_m = Math.abs(angle);
angle\_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a_m, double b, double angle_m) {
double t_0 = angle_m * Math.sqrt(Math.PI);
double tmp;
if (a_m <= 1.9e-92) {
tmp = ((a_m + b) * ((b - a_m) * (2.0 * Math.sin((Math.PI * (angle_m * 0.005555555555555556)))))) * Math.cos(((Math.sqrt(Math.PI) / 180.0) * Math.pow(Math.pow(Math.exp(-1.0), -1.0), Math.log(t_0))));
} else if (a_m <= 1.5e+204) {
tmp = ((a_m + b) * ((b - a_m) * (2.0 * Math.sin((1.0 / ((180.0 / Math.sqrt(Math.PI)) / t_0)))))) * Math.cos(((Math.PI * angle_m) / 180.0));
} else {
tmp = (a_m + b) * ((b - a_m) * Math.sin(((Math.sqrt(Math.PI) * t_0) * 0.011111111111111112)));
}
return angle_s * tmp;
}
a_m = math.fabs(a) angle\_m = math.fabs(angle) angle\_s = math.copysign(1.0, angle) def code(angle_s, a_m, b, angle_m): t_0 = angle_m * math.sqrt(math.pi) tmp = 0 if a_m <= 1.9e-92: tmp = ((a_m + b) * ((b - a_m) * (2.0 * math.sin((math.pi * (angle_m * 0.005555555555555556)))))) * math.cos(((math.sqrt(math.pi) / 180.0) * math.pow(math.pow(math.exp(-1.0), -1.0), math.log(t_0)))) elif a_m <= 1.5e+204: tmp = ((a_m + b) * ((b - a_m) * (2.0 * math.sin((1.0 / ((180.0 / math.sqrt(math.pi)) / t_0)))))) * math.cos(((math.pi * angle_m) / 180.0)) else: tmp = (a_m + b) * ((b - a_m) * math.sin(((math.sqrt(math.pi) * t_0) * 0.011111111111111112))) return angle_s * tmp
a_m = abs(a) angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a_m, b, angle_m) t_0 = Float64(angle_m * sqrt(pi)) tmp = 0.0 if (a_m <= 1.9e-92) tmp = Float64(Float64(Float64(a_m + b) * Float64(Float64(b - a_m) * Float64(2.0 * sin(Float64(pi * Float64(angle_m * 0.005555555555555556)))))) * cos(Float64(Float64(sqrt(pi) / 180.0) * ((exp(-1.0) ^ -1.0) ^ log(t_0))))); elseif (a_m <= 1.5e+204) tmp = Float64(Float64(Float64(a_m + b) * Float64(Float64(b - a_m) * Float64(2.0 * sin(Float64(1.0 / Float64(Float64(180.0 / sqrt(pi)) / t_0)))))) * cos(Float64(Float64(pi * angle_m) / 180.0))); else tmp = Float64(Float64(a_m + b) * Float64(Float64(b - a_m) * sin(Float64(Float64(sqrt(pi) * t_0) * 0.011111111111111112)))); end return Float64(angle_s * tmp) end
a_m = abs(a); angle\_m = abs(angle); angle\_s = sign(angle) * abs(1.0); function tmp_2 = code(angle_s, a_m, b, angle_m) t_0 = angle_m * sqrt(pi); tmp = 0.0; if (a_m <= 1.9e-92) tmp = ((a_m + b) * ((b - a_m) * (2.0 * sin((pi * (angle_m * 0.005555555555555556)))))) * cos(((sqrt(pi) / 180.0) * ((exp(-1.0) ^ -1.0) ^ log(t_0)))); elseif (a_m <= 1.5e+204) tmp = ((a_m + b) * ((b - a_m) * (2.0 * sin((1.0 / ((180.0 / sqrt(pi)) / t_0)))))) * cos(((pi * angle_m) / 180.0)); else tmp = (a_m + b) * ((b - a_m) * sin(((sqrt(pi) * t_0) * 0.011111111111111112))); end tmp_2 = angle_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
angle\_m = N[Abs[angle], $MachinePrecision]
angle\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a$95$m_, b_, angle$95$m_] := Block[{t$95$0 = N[(angle$95$m * N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[a$95$m, 1.9e-92], N[(N[(N[(a$95$m + b), $MachinePrecision] * N[(N[(b - a$95$m), $MachinePrecision] * N[(2.0 * N[Sin[N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(N[(N[Sqrt[Pi], $MachinePrecision] / 180.0), $MachinePrecision] * N[Power[N[Power[N[Exp[-1.0], $MachinePrecision], -1.0], $MachinePrecision], N[Log[t$95$0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[a$95$m, 1.5e+204], N[(N[(N[(a$95$m + b), $MachinePrecision] * N[(N[(b - a$95$m), $MachinePrecision] * N[(2.0 * N[Sin[N[(1.0 / N[(N[(180.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(N[(Pi * angle$95$m), $MachinePrecision] / 180.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(a$95$m + b), $MachinePrecision] * N[(N[(b - a$95$m), $MachinePrecision] * N[Sin[N[(N[(N[Sqrt[Pi], $MachinePrecision] * t$95$0), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|
\\
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
\begin{array}{l}
t_0 := angle\_m \cdot \sqrt{\pi}\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;a\_m \leq 1.9 \cdot 10^{-92}:\\
\;\;\;\;\left(\left(a\_m + b\right) \cdot \left(\left(b - a\_m\right) \cdot \left(2 \cdot \sin \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)\right)\right) \cdot \cos \left(\frac{\sqrt{\pi}}{180} \cdot {\left({\left(e^{-1}\right)}^{-1}\right)}^{\log t\_0}\right)\\
\mathbf{elif}\;a\_m \leq 1.5 \cdot 10^{+204}:\\
\;\;\;\;\left(\left(a\_m + b\right) \cdot \left(\left(b - a\_m\right) \cdot \left(2 \cdot \sin \left(\frac{1}{\frac{\frac{180}{\sqrt{\pi}}}{t\_0}}\right)\right)\right)\right) \cdot \cos \left(\frac{\pi \cdot angle\_m}{180}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a\_m + b\right) \cdot \left(\left(b - a\_m\right) \cdot \sin \left(\left(\sqrt{\pi} \cdot t\_0\right) \cdot 0.011111111111111112\right)\right)\\
\end{array}
\end{array}
\end{array}
if a < 1.9e-92Initial program 54.8%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squaresN/A
associate-*l*N/A
lower-*.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6463.6
lift-/.f64N/A
div-invN/A
lower-*.f64N/A
metadata-eval64.4
Applied rewrites64.4%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lift-PI.f64N/A
add-sqr-sqrtN/A
div-invN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-PI.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lift-PI.f64N/A
lower-sqrt.f64N/A
lower-/.f6466.1
Applied rewrites66.1%
lift-/.f64N/A
clear-numN/A
inv-powN/A
pow-to-expN/A
lower-exp.f64N/A
lower-*.f64N/A
lower-log.f64N/A
clear-numN/A
lift-/.f64N/A
lower-/.f6464.0
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
/-rgt-identityN/A
lower-*.f6465.0
Applied rewrites65.0%
lift-exp.f64N/A
lift-*.f64N/A
*-commutativeN/A
exp-prodN/A
lift-log.f64N/A
lift-/.f64N/A
inv-powN/A
log-powN/A
pow-unpowN/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-exp.f64N/A
/-rgt-identityN/A
lower-log.f64N/A
/-rgt-identity67.9
Applied rewrites67.9%
if 1.9e-92 < a < 1.49999999999999991e204Initial program 54.9%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squaresN/A
associate-*l*N/A
lower-*.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6465.2
lift-/.f64N/A
div-invN/A
lower-*.f64N/A
metadata-eval64.6
Applied rewrites64.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lower-/.f6465.5
Applied rewrites65.5%
lift-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
div-invN/A
associate-*r/N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
associate-*l*N/A
lift-*.f64N/A
/-rgt-identityN/A
*-commutativeN/A
associate-*r/N/A
clear-numN/A
un-div-invN/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
lower-/.f64N/A
/-rgt-identity72.3
Applied rewrites72.3%
if 1.49999999999999991e204 < a Initial program 52.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squaresN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites74.2%
lift-*.f64N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
associate-*l*N/A
lift-*.f64N/A
/-rgt-identityN/A
*-commutativeN/A
lower-*.f64N/A
/-rgt-identity93.4
Applied rewrites93.4%
Final simplification73.0%
a_m = (fabs.f64 a)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a_m b angle_m)
:precision binary64
(let* ((t_0 (* PI (/ angle_m 180.0))))
(*
angle_s
(if (<=
(* (* (* 2.0 (- (pow b 2.0) (pow a_m 2.0))) (sin t_0)) (cos t_0))
5e+42)
(*
(+ a_m b)
(*
(- b a_m)
(sin (* (sqrt PI) (* (sqrt PI) (* angle_m 0.011111111111111112))))))
(*
(cos (/ (* PI angle_m) 180.0))
(*
(+ a_m b)
(*
(- b a_m)
(*
2.0
(sin
(*
(sqrt PI)
(* 0.005555555555555556 (* angle_m (sqrt PI)))))))))))))a_m = fabs(a);
angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a_m, double b, double angle_m) {
double t_0 = ((double) M_PI) * (angle_m / 180.0);
double tmp;
if ((((2.0 * (pow(b, 2.0) - pow(a_m, 2.0))) * sin(t_0)) * cos(t_0)) <= 5e+42) {
tmp = (a_m + b) * ((b - a_m) * sin((sqrt(((double) M_PI)) * (sqrt(((double) M_PI)) * (angle_m * 0.011111111111111112)))));
} else {
tmp = cos(((((double) M_PI) * angle_m) / 180.0)) * ((a_m + b) * ((b - a_m) * (2.0 * sin((sqrt(((double) M_PI)) * (0.005555555555555556 * (angle_m * sqrt(((double) M_PI)))))))));
}
return angle_s * tmp;
}
a_m = Math.abs(a);
angle\_m = Math.abs(angle);
angle\_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a_m, double b, double angle_m) {
double t_0 = Math.PI * (angle_m / 180.0);
double tmp;
if ((((2.0 * (Math.pow(b, 2.0) - Math.pow(a_m, 2.0))) * Math.sin(t_0)) * Math.cos(t_0)) <= 5e+42) {
tmp = (a_m + b) * ((b - a_m) * Math.sin((Math.sqrt(Math.PI) * (Math.sqrt(Math.PI) * (angle_m * 0.011111111111111112)))));
} else {
tmp = Math.cos(((Math.PI * angle_m) / 180.0)) * ((a_m + b) * ((b - a_m) * (2.0 * Math.sin((Math.sqrt(Math.PI) * (0.005555555555555556 * (angle_m * Math.sqrt(Math.PI))))))));
}
return angle_s * tmp;
}
a_m = math.fabs(a) angle\_m = math.fabs(angle) angle\_s = math.copysign(1.0, angle) def code(angle_s, a_m, b, angle_m): t_0 = math.pi * (angle_m / 180.0) tmp = 0 if (((2.0 * (math.pow(b, 2.0) - math.pow(a_m, 2.0))) * math.sin(t_0)) * math.cos(t_0)) <= 5e+42: tmp = (a_m + b) * ((b - a_m) * math.sin((math.sqrt(math.pi) * (math.sqrt(math.pi) * (angle_m * 0.011111111111111112))))) else: tmp = math.cos(((math.pi * angle_m) / 180.0)) * ((a_m + b) * ((b - a_m) * (2.0 * math.sin((math.sqrt(math.pi) * (0.005555555555555556 * (angle_m * math.sqrt(math.pi)))))))) return angle_s * tmp
a_m = abs(a) angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a_m, b, angle_m) t_0 = Float64(pi * Float64(angle_m / 180.0)) tmp = 0.0 if (Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a_m ^ 2.0))) * sin(t_0)) * cos(t_0)) <= 5e+42) tmp = Float64(Float64(a_m + b) * Float64(Float64(b - a_m) * sin(Float64(sqrt(pi) * Float64(sqrt(pi) * Float64(angle_m * 0.011111111111111112)))))); else tmp = Float64(cos(Float64(Float64(pi * angle_m) / 180.0)) * Float64(Float64(a_m + b) * Float64(Float64(b - a_m) * Float64(2.0 * sin(Float64(sqrt(pi) * Float64(0.005555555555555556 * Float64(angle_m * sqrt(pi))))))))); end return Float64(angle_s * tmp) end
a_m = abs(a); angle\_m = abs(angle); angle\_s = sign(angle) * abs(1.0); function tmp_2 = code(angle_s, a_m, b, angle_m) t_0 = pi * (angle_m / 180.0); tmp = 0.0; if ((((2.0 * ((b ^ 2.0) - (a_m ^ 2.0))) * sin(t_0)) * cos(t_0)) <= 5e+42) tmp = (a_m + b) * ((b - a_m) * sin((sqrt(pi) * (sqrt(pi) * (angle_m * 0.011111111111111112))))); else tmp = cos(((pi * angle_m) / 180.0)) * ((a_m + b) * ((b - a_m) * (2.0 * sin((sqrt(pi) * (0.005555555555555556 * (angle_m * sqrt(pi)))))))); end tmp_2 = angle_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
angle\_m = N[Abs[angle], $MachinePrecision]
angle\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a$95$m_, b_, angle$95$m_] := Block[{t$95$0 = N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 5e+42], N[(N[(a$95$m + b), $MachinePrecision] * N[(N[(b - a$95$m), $MachinePrecision] * N[Sin[N[(N[Sqrt[Pi], $MachinePrecision] * N[(N[Sqrt[Pi], $MachinePrecision] * N[(angle$95$m * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(N[(Pi * angle$95$m), $MachinePrecision] / 180.0), $MachinePrecision]], $MachinePrecision] * N[(N[(a$95$m + b), $MachinePrecision] * N[(N[(b - a$95$m), $MachinePrecision] * N[(2.0 * N[Sin[N[(N[Sqrt[Pi], $MachinePrecision] * N[(0.005555555555555556 * N[(angle$95$m * N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|
\\
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle\_m}{180}\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;\left(\left(2 \cdot \left({b}^{2} - {a\_m}^{2}\right)\right) \cdot \sin t\_0\right) \cdot \cos t\_0 \leq 5 \cdot 10^{+42}:\\
\;\;\;\;\left(a\_m + b\right) \cdot \left(\left(b - a\_m\right) \cdot \sin \left(\sqrt{\pi} \cdot \left(\sqrt{\pi} \cdot \left(angle\_m \cdot 0.011111111111111112\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\cos \left(\frac{\pi \cdot angle\_m}{180}\right) \cdot \left(\left(a\_m + b\right) \cdot \left(\left(b - a\_m\right) \cdot \left(2 \cdot \sin \left(\sqrt{\pi} \cdot \left(0.005555555555555556 \cdot \left(angle\_m \cdot \sqrt{\pi}\right)\right)\right)\right)\right)\right)\\
\end{array}
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) (sin.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) (cos.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) < 5.00000000000000007e42Initial program 62.0%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squaresN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites68.1%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6467.9
Applied rewrites67.9%
if 5.00000000000000007e42 < (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) (sin.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) (cos.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) Initial program 39.5%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squaresN/A
associate-*l*N/A
lower-*.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6464.8
lift-/.f64N/A
div-invN/A
lower-*.f64N/A
metadata-eval65.0
Applied rewrites65.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lower-/.f6465.0
Applied rewrites65.0%
lift-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
div-invN/A
associate-*r/N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
associate-*l*N/A
lift-*.f64N/A
/-rgt-identityN/A
associate-/l*N/A
lower-*.f64N/A
div-invN/A
metadata-evalN/A
lower-*.f64N/A
/-rgt-identity64.7
Applied rewrites64.7%
Final simplification66.8%
herbie shell --seed 2024228
(FPCore (a b angle)
:name "ab-angle->ABCF B"
:precision binary64
(* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin (* PI (/ angle 180.0)))) (cos (* PI (/ angle 180.0)))))