
(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:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(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}
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (/ (* PI 0.005555555555555556) (/ 1.0 angle)))) 2.0) (pow (* b (cos (* PI (/ angle 180.0)))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin(((((double) M_PI) * 0.005555555555555556) / (1.0 / angle)))), 2.0) + pow((b * cos((((double) M_PI) * (angle / 180.0)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin(((Math.PI * 0.005555555555555556) / (1.0 / angle)))), 2.0) + Math.pow((b * Math.cos((Math.PI * (angle / 180.0)))), 2.0);
}
def code(a, b, angle): return math.pow((a * math.sin(((math.pi * 0.005555555555555556) / (1.0 / angle)))), 2.0) + math.pow((b * math.cos((math.pi * (angle / 180.0)))), 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(Float64(pi * 0.005555555555555556) / Float64(1.0 / angle)))) ^ 2.0) + (Float64(b * cos(Float64(pi * Float64(angle / 180.0)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin(((pi * 0.005555555555555556) / (1.0 / angle)))) ^ 2.0) + ((b * cos((pi * (angle / 180.0)))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(N[(Pi * 0.005555555555555556), $MachinePrecision] / N[(1.0 / angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\frac{\pi \cdot 0.005555555555555556}{\frac{1}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2}
\end{array}
Initial program 80.8%
add-cube-cbrt80.4%
pow380.4%
associate-*l/80.5%
associate-*r/80.5%
div-inv80.5%
metadata-eval80.5%
Applied egg-rr80.5%
rem-cube-cbrt80.8%
*-commutative80.8%
metadata-eval80.8%
div-inv80.8%
associate-/r/80.9%
div-inv80.9%
associate-/r*80.9%
div-inv80.9%
metadata-eval80.9%
Applied egg-rr80.9%
Final simplification80.9%
(FPCore (a b angle) :precision binary64 (+ (pow (* b (cos (* PI (/ angle 180.0)))) 2.0) (pow (* a (sin (/ PI (/ 180.0 angle)))) 2.0)))
double code(double a, double b, double angle) {
return pow((b * cos((((double) M_PI) * (angle / 180.0)))), 2.0) + pow((a * sin((((double) M_PI) / (180.0 / angle)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((b * Math.cos((Math.PI * (angle / 180.0)))), 2.0) + Math.pow((a * Math.sin((Math.PI / (180.0 / angle)))), 2.0);
}
def code(a, b, angle): return math.pow((b * math.cos((math.pi * (angle / 180.0)))), 2.0) + math.pow((a * math.sin((math.pi / (180.0 / angle)))), 2.0)
function code(a, b, angle) return Float64((Float64(b * cos(Float64(pi * Float64(angle / 180.0)))) ^ 2.0) + (Float64(a * sin(Float64(pi / Float64(180.0 / angle)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((b * cos((pi * (angle / 180.0)))) ^ 2.0) + ((a * sin((pi / (180.0 / angle)))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(b * N[Cos[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Sin[N[(Pi / N[(180.0 / angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(b \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2}
\end{array}
Initial program 80.8%
*-commutative80.8%
clear-num80.8%
un-div-inv80.9%
Applied egg-rr80.9%
Final simplification80.9%
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* (* PI 0.005555555555555556) angle))) (pow (hypot (* a (sin t_0)) (* b (cos t_0))) 2.0)))
double code(double a, double b, double angle) {
double t_0 = (((double) M_PI) * 0.005555555555555556) * angle;
return pow(hypot((a * sin(t_0)), (b * cos(t_0))), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = (Math.PI * 0.005555555555555556) * angle;
return Math.pow(Math.hypot((a * Math.sin(t_0)), (b * Math.cos(t_0))), 2.0);
}
def code(a, b, angle): t_0 = (math.pi * 0.005555555555555556) * angle return math.pow(math.hypot((a * math.sin(t_0)), (b * math.cos(t_0))), 2.0)
function code(a, b, angle) t_0 = Float64(Float64(pi * 0.005555555555555556) * angle) return hypot(Float64(a * sin(t_0)), Float64(b * cos(t_0))) ^ 2.0 end
function tmp = code(a, b, angle) t_0 = (pi * 0.005555555555555556) * angle; tmp = hypot((a * sin(t_0)), (b * cos(t_0))) ^ 2.0; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[(Pi * 0.005555555555555556), $MachinePrecision] * angle), $MachinePrecision]}, N[Power[N[Sqrt[N[(a * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision] ^ 2 + N[(b * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\pi \cdot 0.005555555555555556\right) \cdot angle\\
{\left(\mathsf{hypot}\left(a \cdot \sin t\_0, b \cdot \cos t\_0\right)\right)}^{2}
\end{array}
\end{array}
Initial program 80.8%
unpow280.8%
associate-*l/80.8%
associate-/l*80.8%
unpow280.8%
Simplified80.9%
Applied egg-rr80.9%
Final simplification80.9%
(FPCore (a b angle) :precision binary64 (if (<= a 2.06e+127) (* (pow b 2.0) (pow (cos (* PI (* 0.005555555555555556 angle))) 2.0)) (pow (* a (sin (* angle (* PI -0.005555555555555556)))) 2.0)))
double code(double a, double b, double angle) {
double tmp;
if (a <= 2.06e+127) {
tmp = pow(b, 2.0) * pow(cos((((double) M_PI) * (0.005555555555555556 * angle))), 2.0);
} else {
tmp = pow((a * sin((angle * (((double) M_PI) * -0.005555555555555556)))), 2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 2.06e+127) {
tmp = Math.pow(b, 2.0) * Math.pow(Math.cos((Math.PI * (0.005555555555555556 * angle))), 2.0);
} else {
tmp = Math.pow((a * Math.sin((angle * (Math.PI * -0.005555555555555556)))), 2.0);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if a <= 2.06e+127: tmp = math.pow(b, 2.0) * math.pow(math.cos((math.pi * (0.005555555555555556 * angle))), 2.0) else: tmp = math.pow((a * math.sin((angle * (math.pi * -0.005555555555555556)))), 2.0) return tmp
function code(a, b, angle) tmp = 0.0 if (a <= 2.06e+127) tmp = Float64((b ^ 2.0) * (cos(Float64(pi * Float64(0.005555555555555556 * angle))) ^ 2.0)); else tmp = Float64(a * sin(Float64(angle * Float64(pi * -0.005555555555555556)))) ^ 2.0; end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 2.06e+127) tmp = (b ^ 2.0) * (cos((pi * (0.005555555555555556 * angle))) ^ 2.0); else tmp = (a * sin((angle * (pi * -0.005555555555555556)))) ^ 2.0; end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[a, 2.06e+127], N[(N[Power[b, 2.0], $MachinePrecision] * N[Power[N[Cos[N[(Pi * N[(0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[Power[N[(a * N[Sin[N[(angle * N[(Pi * -0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 2.06 \cdot 10^{+127}:\\
\;\;\;\;{b}^{2} \cdot {\cos \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(a \cdot \sin \left(angle \cdot \left(\pi \cdot -0.005555555555555556\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if a < 2.06000000000000001e127Initial program 77.4%
unpow277.4%
associate-*l/77.5%
associate-/l*77.4%
unpow277.4%
Simplified77.5%
Taylor expanded in a around 0 58.3%
associate-*r*58.3%
Simplified58.3%
if 2.06000000000000001e127 < a Initial program 96.2%
*-commutative96.2%
clear-num96.2%
un-div-inv96.3%
Applied egg-rr96.3%
Applied egg-rr96.3%
Taylor expanded in a around -inf 81.6%
mul-1-neg81.6%
distribute-rgt-neg-in81.6%
*-commutative81.6%
associate-*r*81.7%
*-commutative81.7%
*-commutative81.7%
associate-*r*81.6%
metadata-eval81.6%
metadata-eval81.6%
rem-cube-cbrt81.6%
rem-cube-cbrt80.6%
distribute-rgt-neg-in80.6%
associate-*r*80.7%
sin-neg80.7%
remove-double-neg80.7%
Simplified81.7%
Final simplification62.5%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (/ (* PI 0.005555555555555556) (/ 1.0 angle)))) 2.0) (pow b 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin(((((double) M_PI) * 0.005555555555555556) / (1.0 / angle)))), 2.0) + pow(b, 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin(((Math.PI * 0.005555555555555556) / (1.0 / angle)))), 2.0) + Math.pow(b, 2.0);
}
def code(a, b, angle): return math.pow((a * math.sin(((math.pi * 0.005555555555555556) / (1.0 / angle)))), 2.0) + math.pow(b, 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(Float64(pi * 0.005555555555555556) / Float64(1.0 / angle)))) ^ 2.0) + (b ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin(((pi * 0.005555555555555556) / (1.0 / angle)))) ^ 2.0) + (b ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(N[(Pi * 0.005555555555555556), $MachinePrecision] / N[(1.0 / angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\frac{\pi \cdot 0.005555555555555556}{\frac{1}{angle}}\right)\right)}^{2} + {b}^{2}
\end{array}
Initial program 80.8%
add-cube-cbrt80.4%
pow380.4%
associate-*l/80.5%
associate-*r/80.5%
div-inv80.5%
metadata-eval80.5%
Applied egg-rr80.5%
rem-cube-cbrt80.8%
*-commutative80.8%
metadata-eval80.8%
div-inv80.8%
associate-/r/80.9%
div-inv80.9%
associate-/r*80.9%
div-inv80.9%
metadata-eval80.9%
Applied egg-rr80.9%
add-cube-cbrt80.9%
pow280.9%
Applied egg-rr80.9%
Taylor expanded in angle around 0 80.7%
(FPCore (a b angle) :precision binary64 (+ (pow b 2.0) (pow (* a (sin (* PI (/ angle 180.0)))) 2.0)))
double code(double a, double b, double angle) {
return pow(b, 2.0) + pow((a * sin((((double) M_PI) * (angle / 180.0)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow(b, 2.0) + Math.pow((a * Math.sin((Math.PI * (angle / 180.0)))), 2.0);
}
def code(a, b, angle): return math.pow(b, 2.0) + math.pow((a * math.sin((math.pi * (angle / 180.0)))), 2.0)
function code(a, b, angle) return Float64((b ^ 2.0) + (Float64(a * sin(Float64(pi * Float64(angle / 180.0)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = (b ^ 2.0) + ((a * sin((pi * (angle / 180.0)))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[b, 2.0], $MachinePrecision] + N[Power[N[(a * N[Sin[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{b}^{2} + {\left(a \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2}
\end{array}
Initial program 80.8%
associate-*l/80.8%
clear-num80.8%
Applied egg-rr80.8%
Taylor expanded in angle around 0 80.6%
Final simplification80.6%
(FPCore (a b angle) :precision binary64 (pow (hypot b (* a (sin (* (* PI 0.005555555555555556) angle)))) 2.0))
double code(double a, double b, double angle) {
return pow(hypot(b, (a * sin(((((double) M_PI) * 0.005555555555555556) * angle)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow(Math.hypot(b, (a * Math.sin(((Math.PI * 0.005555555555555556) * angle)))), 2.0);
}
def code(a, b, angle): return math.pow(math.hypot(b, (a * math.sin(((math.pi * 0.005555555555555556) * angle)))), 2.0)
function code(a, b, angle) return hypot(b, Float64(a * sin(Float64(Float64(pi * 0.005555555555555556) * angle)))) ^ 2.0 end
function tmp = code(a, b, angle) tmp = hypot(b, (a * sin(((pi * 0.005555555555555556) * angle)))) ^ 2.0; end
code[a_, b_, angle_] := N[Power[N[Sqrt[b ^ 2 + N[(a * N[Sin[N[(N[(Pi * 0.005555555555555556), $MachinePrecision] * angle), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision], 2.0], $MachinePrecision]
\begin{array}{l}
\\
{\left(\mathsf{hypot}\left(b, a \cdot \sin \left(\left(\pi \cdot 0.005555555555555556\right) \cdot angle\right)\right)\right)}^{2}
\end{array}
Initial program 80.8%
*-commutative80.8%
clear-num80.8%
un-div-inv80.9%
Applied egg-rr80.9%
Applied egg-rr80.9%
Taylor expanded in angle around 0 80.6%
Final simplification80.6%
(FPCore (a b angle) :precision binary64 (if (<= a 8.2e+123) (pow (* b (cos (* 0.005555555555555556 (* PI angle)))) 2.0) (pow (* a (sin (* angle (* PI -0.005555555555555556)))) 2.0)))
double code(double a, double b, double angle) {
double tmp;
if (a <= 8.2e+123) {
tmp = pow((b * cos((0.005555555555555556 * (((double) M_PI) * angle)))), 2.0);
} else {
tmp = pow((a * sin((angle * (((double) M_PI) * -0.005555555555555556)))), 2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 8.2e+123) {
tmp = Math.pow((b * Math.cos((0.005555555555555556 * (Math.PI * angle)))), 2.0);
} else {
tmp = Math.pow((a * Math.sin((angle * (Math.PI * -0.005555555555555556)))), 2.0);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if a <= 8.2e+123: tmp = math.pow((b * math.cos((0.005555555555555556 * (math.pi * angle)))), 2.0) else: tmp = math.pow((a * math.sin((angle * (math.pi * -0.005555555555555556)))), 2.0) return tmp
function code(a, b, angle) tmp = 0.0 if (a <= 8.2e+123) tmp = Float64(b * cos(Float64(0.005555555555555556 * Float64(pi * angle)))) ^ 2.0; else tmp = Float64(a * sin(Float64(angle * Float64(pi * -0.005555555555555556)))) ^ 2.0; end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 8.2e+123) tmp = (b * cos((0.005555555555555556 * (pi * angle)))) ^ 2.0; else tmp = (a * sin((angle * (pi * -0.005555555555555556)))) ^ 2.0; end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[a, 8.2e+123], N[Power[N[(b * N[Cos[N[(0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[Power[N[(a * N[Sin[N[(angle * N[(Pi * -0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 8.2 \cdot 10^{+123}:\\
\;\;\;\;{\left(b \cdot \cos \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(a \cdot \sin \left(angle \cdot \left(\pi \cdot -0.005555555555555556\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if a < 8.19999999999999979e123Initial program 77.4%
unpow277.4%
associate-*l/77.5%
associate-/l*77.4%
unpow277.4%
Simplified77.5%
Taylor expanded in a around 0 58.3%
*-commutative58.3%
associate-*r*58.3%
unpow258.3%
unpow258.3%
swap-sqr58.3%
unpow258.3%
associate-*r*58.3%
*-commutative58.3%
Simplified58.3%
if 8.19999999999999979e123 < a Initial program 96.2%
*-commutative96.2%
clear-num96.2%
un-div-inv96.3%
Applied egg-rr96.3%
Applied egg-rr96.3%
Taylor expanded in a around -inf 81.6%
mul-1-neg81.6%
distribute-rgt-neg-in81.6%
*-commutative81.6%
associate-*r*81.7%
*-commutative81.7%
*-commutative81.7%
associate-*r*81.6%
metadata-eval81.6%
metadata-eval81.6%
rem-cube-cbrt81.6%
rem-cube-cbrt80.6%
distribute-rgt-neg-in80.6%
associate-*r*80.7%
sin-neg80.7%
remove-double-neg80.7%
Simplified81.7%
Final simplification62.5%
(FPCore (a b angle) :precision binary64 (if (<= a 1.12e+126) (* b b) (pow (* a (sin (* angle (* PI -0.005555555555555556)))) 2.0)))
double code(double a, double b, double angle) {
double tmp;
if (a <= 1.12e+126) {
tmp = b * b;
} else {
tmp = pow((a * sin((angle * (((double) M_PI) * -0.005555555555555556)))), 2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 1.12e+126) {
tmp = b * b;
} else {
tmp = Math.pow((a * Math.sin((angle * (Math.PI * -0.005555555555555556)))), 2.0);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if a <= 1.12e+126: tmp = b * b else: tmp = math.pow((a * math.sin((angle * (math.pi * -0.005555555555555556)))), 2.0) return tmp
function code(a, b, angle) tmp = 0.0 if (a <= 1.12e+126) tmp = Float64(b * b); else tmp = Float64(a * sin(Float64(angle * Float64(pi * -0.005555555555555556)))) ^ 2.0; end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 1.12e+126) tmp = b * b; else tmp = (a * sin((angle * (pi * -0.005555555555555556)))) ^ 2.0; end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[a, 1.12e+126], N[(b * b), $MachinePrecision], N[Power[N[(a * N[Sin[N[(angle * N[(Pi * -0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.12 \cdot 10^{+126}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;{\left(a \cdot \sin \left(angle \cdot \left(\pi \cdot -0.005555555555555556\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if a < 1.12e126Initial program 77.4%
unpow277.4%
associate-*l/77.5%
associate-/l*77.4%
unpow277.4%
Simplified77.5%
Taylor expanded in angle around 0 58.0%
unpow258.0%
Applied egg-rr58.0%
if 1.12e126 < a Initial program 96.2%
*-commutative96.2%
clear-num96.2%
un-div-inv96.3%
Applied egg-rr96.3%
Applied egg-rr96.3%
Taylor expanded in a around -inf 81.6%
mul-1-neg81.6%
distribute-rgt-neg-in81.6%
*-commutative81.6%
associate-*r*81.7%
*-commutative81.7%
*-commutative81.7%
associate-*r*81.6%
metadata-eval81.6%
metadata-eval81.6%
rem-cube-cbrt81.6%
rem-cube-cbrt80.6%
distribute-rgt-neg-in80.6%
associate-*r*80.7%
sin-neg80.7%
remove-double-neg80.7%
Simplified81.7%
(FPCore (a b angle) :precision binary64 (if (<= a 7.1e+129) (* b b) (pow (* a (sin (* 0.005555555555555556 (* PI angle)))) 2.0)))
double code(double a, double b, double angle) {
double tmp;
if (a <= 7.1e+129) {
tmp = b * b;
} else {
tmp = pow((a * sin((0.005555555555555556 * (((double) M_PI) * angle)))), 2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 7.1e+129) {
tmp = b * b;
} else {
tmp = Math.pow((a * Math.sin((0.005555555555555556 * (Math.PI * angle)))), 2.0);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if a <= 7.1e+129: tmp = b * b else: tmp = math.pow((a * math.sin((0.005555555555555556 * (math.pi * angle)))), 2.0) return tmp
function code(a, b, angle) tmp = 0.0 if (a <= 7.1e+129) tmp = Float64(b * b); else tmp = Float64(a * sin(Float64(0.005555555555555556 * Float64(pi * angle)))) ^ 2.0; end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 7.1e+129) tmp = b * b; else tmp = (a * sin((0.005555555555555556 * (pi * angle)))) ^ 2.0; end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[a, 7.1e+129], N[(b * b), $MachinePrecision], N[Power[N[(a * N[Sin[N[(0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 7.1 \cdot 10^{+129}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;{\left(a \cdot \sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if a < 7.09999999999999996e129Initial program 77.4%
unpow277.4%
associate-*l/77.5%
associate-/l*77.4%
unpow277.4%
Simplified77.5%
Taylor expanded in angle around 0 58.0%
unpow258.0%
Applied egg-rr58.0%
if 7.09999999999999996e129 < a Initial program 96.2%
unpow296.2%
associate-*l/96.3%
associate-/l*96.3%
unpow296.3%
Simplified96.3%
Taylor expanded in a around inf 65.4%
unpow265.4%
*-commutative65.4%
associate-*r*65.4%
unpow265.4%
swap-sqr81.7%
unpow281.7%
associate-*r*81.6%
*-commutative81.6%
Simplified81.6%
Final simplification62.3%
(FPCore (a b angle) :precision binary64 (if (<= a 1.95e+157) (* b b) (cbrt (pow b 6.0))))
double code(double a, double b, double angle) {
double tmp;
if (a <= 1.95e+157) {
tmp = b * b;
} else {
tmp = cbrt(pow(b, 6.0));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 1.95e+157) {
tmp = b * b;
} else {
tmp = Math.cbrt(Math.pow(b, 6.0));
}
return tmp;
}
function code(a, b, angle) tmp = 0.0 if (a <= 1.95e+157) tmp = Float64(b * b); else tmp = cbrt((b ^ 6.0)); end return tmp end
code[a_, b_, angle_] := If[LessEqual[a, 1.95e+157], N[(b * b), $MachinePrecision], N[Power[N[Power[b, 6.0], $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.95 \cdot 10^{+157}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{b}^{6}}\\
\end{array}
\end{array}
if a < 1.94999999999999985e157Initial program 77.5%
unpow277.5%
associate-*l/77.5%
associate-/l*77.4%
unpow277.4%
Simplified77.5%
Taylor expanded in angle around 0 57.2%
unpow257.2%
Applied egg-rr57.2%
if 1.94999999999999985e157 < a Initial program 99.5%
unpow299.5%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in angle around 0 40.2%
add-sqr-sqrt40.2%
sqrt-unprod42.6%
pow-prod-up42.6%
metadata-eval42.6%
Applied egg-rr42.6%
add-cbrt-cube42.5%
pow1/342.5%
add-sqr-sqrt42.5%
sqrt-pow142.5%
metadata-eval42.5%
pow-prod-up42.5%
metadata-eval42.5%
Applied egg-rr42.5%
unpow1/342.5%
Simplified42.5%
(FPCore (a b angle) :precision binary64 (* b b))
double code(double a, double b, double angle) {
return b * b;
}
real(8) function code(a, b, angle)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
code = b * b
end function
public static double code(double a, double b, double angle) {
return b * b;
}
def code(a, b, angle): return b * b
function code(a, b, angle) return Float64(b * b) end
function tmp = code(a, b, angle) tmp = b * b; end
code[a_, b_, angle_] := N[(b * b), $MachinePrecision]
\begin{array}{l}
\\
b \cdot b
\end{array}
Initial program 80.8%
unpow280.8%
associate-*l/80.8%
associate-/l*80.8%
unpow280.8%
Simplified80.9%
Taylor expanded in angle around 0 54.6%
unpow254.6%
Applied egg-rr54.6%
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)))