
(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 11 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}
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* a (sin (pow (sqrt (* angle_m (* PI 0.005555555555555556))) 2.0))) 2.0) (pow (* b (cos (* PI (/ angle_m 180.0)))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((a * sin(pow(sqrt((angle_m * (((double) M_PI) * 0.005555555555555556))), 2.0))), 2.0) + pow((b * cos((((double) M_PI) * (angle_m / 180.0)))), 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.pow(Math.sqrt((angle_m * (Math.PI * 0.005555555555555556))), 2.0))), 2.0) + Math.pow((b * Math.cos((Math.PI * (angle_m / 180.0)))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow((a * math.sin(math.pow(math.sqrt((angle_m * (math.pi * 0.005555555555555556))), 2.0))), 2.0) + math.pow((b * math.cos((math.pi * (angle_m / 180.0)))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(a * sin((sqrt(Float64(angle_m * Float64(pi * 0.005555555555555556))) ^ 2.0))) ^ 2.0) + (Float64(b * cos(Float64(pi * Float64(angle_m / 180.0)))) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((a * sin((sqrt((angle_m * (pi * 0.005555555555555556))) ^ 2.0))) ^ 2.0) + ((b * cos((pi * (angle_m / 180.0)))) ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[N[(a * N[Sin[N[Power[N[Sqrt[N[(angle$95$m * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(a \cdot \sin \left({\left(\sqrt{angle\_m \cdot \left(\pi \cdot 0.005555555555555556\right)}\right)}^{2}\right)\right)}^{2} + {\left(b \cdot \cos \left(\pi \cdot \frac{angle\_m}{180}\right)\right)}^{2}
\end{array}
Initial program 82.3%
add-sqr-sqrt33.7%
pow233.7%
associate-*l/33.7%
associate-*r/33.7%
div-inv33.7%
metadata-eval33.7%
Applied egg-rr33.7%
Final simplification33.7%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* b (cos (* PI (/ angle_m 180.0)))) 2.0) (pow (* a (sin (/ 1.0 (/ 180.0 (* angle_m PI))))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((b * cos((((double) M_PI) * (angle_m / 180.0)))), 2.0) + pow((a * sin((1.0 / (180.0 / (angle_m * ((double) M_PI)))))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow((b * Math.cos((Math.PI * (angle_m / 180.0)))), 2.0) + Math.pow((a * Math.sin((1.0 / (180.0 / (angle_m * Math.PI))))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow((b * math.cos((math.pi * (angle_m / 180.0)))), 2.0) + math.pow((a * math.sin((1.0 / (180.0 / (angle_m * math.pi))))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(b * cos(Float64(pi * Float64(angle_m / 180.0)))) ^ 2.0) + (Float64(a * sin(Float64(1.0 / Float64(180.0 / Float64(angle_m * pi))))) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((b * cos((pi * (angle_m / 180.0)))) ^ 2.0) + ((a * sin((1.0 / (180.0 / (angle_m * pi))))) ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[N[(b * N[Cos[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Sin[N[(1.0 / N[(180.0 / N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(b \cdot \cos \left(\pi \cdot \frac{angle\_m}{180}\right)\right)}^{2} + {\left(a \cdot \sin \left(\frac{1}{\frac{180}{angle\_m \cdot \pi}}\right)\right)}^{2}
\end{array}
Initial program 82.3%
associate-*l/82.4%
clear-num82.4%
Applied egg-rr82.4%
Final simplification82.4%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* b (cos (* PI (/ angle_m 180.0)))) 2.0) (pow (* a (sin (/ (* angle_m PI) 180.0))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((b * cos((((double) M_PI) * (angle_m / 180.0)))), 2.0) + pow((a * sin(((angle_m * ((double) M_PI)) / 180.0))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow((b * Math.cos((Math.PI * (angle_m / 180.0)))), 2.0) + Math.pow((a * Math.sin(((angle_m * Math.PI) / 180.0))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow((b * math.cos((math.pi * (angle_m / 180.0)))), 2.0) + math.pow((a * math.sin(((angle_m * math.pi) / 180.0))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(b * cos(Float64(pi * Float64(angle_m / 180.0)))) ^ 2.0) + (Float64(a * sin(Float64(Float64(angle_m * pi) / 180.0))) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((b * cos((pi * (angle_m / 180.0)))) ^ 2.0) + ((a * sin(((angle_m * pi) / 180.0))) ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[N[(b * N[Cos[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Sin[N[(N[(angle$95$m * Pi), $MachinePrecision] / 180.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(b \cdot \cos \left(\pi \cdot \frac{angle\_m}{180}\right)\right)}^{2} + {\left(a \cdot \sin \left(\frac{angle\_m \cdot \pi}{180}\right)\right)}^{2}
\end{array}
Initial program 82.3%
associate-*l/82.4%
Applied egg-rr82.4%
Final simplification82.4%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (let* ((t_0 (* angle_m (/ PI 180.0)))) (+ (pow (* a (sin t_0)) 2.0) (pow (* b (cos t_0)) 2.0))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double t_0 = angle_m * (((double) M_PI) / 180.0);
return pow((a * sin(t_0)), 2.0) + pow((b * cos(t_0)), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double t_0 = angle_m * (Math.PI / 180.0);
return Math.pow((a * Math.sin(t_0)), 2.0) + Math.pow((b * Math.cos(t_0)), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): t_0 = angle_m * (math.pi / 180.0) return math.pow((a * math.sin(t_0)), 2.0) + math.pow((b * math.cos(t_0)), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) t_0 = Float64(angle_m * Float64(pi / 180.0)) return Float64((Float64(a * sin(t_0)) ^ 2.0) + (Float64(b * cos(t_0)) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) t_0 = angle_m * (pi / 180.0); tmp = ((a * sin(t_0)) ^ 2.0) + ((b * cos(t_0)) ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[(angle$95$m * N[(Pi / 180.0), $MachinePrecision]), $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}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := angle\_m \cdot \frac{\pi}{180}\\
{\left(a \cdot \sin t\_0\right)}^{2} + {\left(b \cdot \cos t\_0\right)}^{2}
\end{array}
\end{array}
Initial program 82.3%
associate-*l/82.4%
associate-/l*82.4%
cos-neg82.4%
distribute-lft-neg-out82.4%
distribute-frac-neg82.4%
distribute-frac-neg82.4%
distribute-lft-neg-out82.4%
cos-neg82.4%
associate-*l/82.4%
associate-/l*82.3%
Simplified82.3%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* a (sin (* angle_m (/ PI 180.0)))) 2.0) (pow b 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((a * sin((angle_m * (((double) M_PI) / 180.0)))), 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((angle_m * (Math.PI / 180.0)))), 2.0) + Math.pow(b, 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow((a * math.sin((angle_m * (math.pi / 180.0)))), 2.0) + math.pow(b, 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(a * sin(Float64(angle_m * Float64(pi / 180.0)))) ^ 2.0) + (b ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((a * sin((angle_m * (pi / 180.0)))) ^ 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[(angle$95$m * N[(Pi / 180.0), $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(angle\_m \cdot \frac{\pi}{180}\right)\right)}^{2} + {b}^{2}
\end{array}
Initial program 82.3%
associate-*l/82.4%
associate-/l*82.4%
cos-neg82.4%
distribute-lft-neg-out82.4%
distribute-frac-neg82.4%
distribute-frac-neg82.4%
distribute-lft-neg-out82.4%
cos-neg82.4%
associate-*l/82.4%
associate-/l*82.3%
Simplified82.3%
Taylor expanded in angle around 0 82.0%
Final simplification82.0%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow b 2.0) (pow (* a (sin (* PI (/ angle_m 180.0)))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow(b, 2.0) + pow((a * sin((((double) M_PI) * (angle_m / 180.0)))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow(b, 2.0) + Math.pow((a * Math.sin((Math.PI * (angle_m / 180.0)))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow(b, 2.0) + math.pow((a * math.sin((math.pi * (angle_m / 180.0)))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((b ^ 2.0) + (Float64(a * sin(Float64(pi * Float64(angle_m / 180.0)))) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = (b ^ 2.0) + ((a * sin((pi * (angle_m / 180.0)))) ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[b, 2.0], $MachinePrecision] + N[Power[N[(a * N[Sin[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{b}^{2} + {\left(a \cdot \sin \left(\pi \cdot \frac{angle\_m}{180}\right)\right)}^{2}
\end{array}
Initial program 82.3%
add-sqr-sqrt33.7%
pow233.7%
associate-*l/33.7%
associate-*r/33.7%
div-inv33.7%
metadata-eval33.7%
Applied egg-rr33.7%
Taylor expanded in angle around 0 82.0%
Final simplification82.0%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= b 6e-151) (pow (* a (sin (/ angle_m (/ 180.0 PI)))) 2.0) (+ (pow b 2.0) (pow (* 0.005555555555555556 (* a (* angle_m PI))) 2.0))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (b <= 6e-151) {
tmp = pow((a * sin((angle_m / (180.0 / ((double) M_PI))))), 2.0);
} else {
tmp = pow(b, 2.0) + pow((0.005555555555555556 * (a * (angle_m * ((double) M_PI)))), 2.0);
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (b <= 6e-151) {
tmp = Math.pow((a * Math.sin((angle_m / (180.0 / Math.PI)))), 2.0);
} else {
tmp = Math.pow(b, 2.0) + Math.pow((0.005555555555555556 * (a * (angle_m * Math.PI))), 2.0);
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): tmp = 0 if b <= 6e-151: tmp = math.pow((a * math.sin((angle_m / (180.0 / math.pi)))), 2.0) else: tmp = math.pow(b, 2.0) + math.pow((0.005555555555555556 * (a * (angle_m * math.pi))), 2.0) return tmp
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (b <= 6e-151) tmp = Float64(a * sin(Float64(angle_m / Float64(180.0 / pi)))) ^ 2.0; else tmp = Float64((b ^ 2.0) + (Float64(0.005555555555555556 * Float64(a * Float64(angle_m * pi))) ^ 2.0)); end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) tmp = 0.0; if (b <= 6e-151) tmp = (a * sin((angle_m / (180.0 / pi)))) ^ 2.0; else tmp = (b ^ 2.0) + ((0.005555555555555556 * (a * (angle_m * pi))) ^ 2.0); end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[b, 6e-151], N[Power[N[(a * N[Sin[N[(angle$95$m / N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(N[Power[b, 2.0], $MachinePrecision] + N[Power[N[(0.005555555555555556 * N[(a * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;b \leq 6 \cdot 10^{-151}:\\
\;\;\;\;{\left(a \cdot \sin \left(\frac{angle\_m}{\frac{180}{\pi}}\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{b}^{2} + {\left(0.005555555555555556 \cdot \left(a \cdot \left(angle\_m \cdot \pi\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if b < 6e-151Initial program 83.2%
associate-*l/83.2%
Applied egg-rr83.2%
Taylor expanded in a around inf 43.5%
unpow243.5%
*-commutative43.5%
associate-*r*43.5%
unpow243.5%
swap-sqr48.6%
unpow248.6%
associate-*r*48.5%
*-commutative48.5%
associate-*r*48.5%
*-commutative48.5%
metadata-eval48.5%
associate-/l*48.5%
*-rgt-identity48.5%
associate-/r/48.5%
Simplified48.5%
if 6e-151 < b Initial program 81.1%
associate-*l/81.1%
associate-/l*81.0%
cos-neg81.0%
distribute-lft-neg-out81.0%
distribute-frac-neg81.0%
distribute-frac-neg81.0%
distribute-lft-neg-out81.0%
cos-neg81.0%
associate-*l/81.0%
associate-/l*81.1%
Simplified81.1%
associate-*r/81.1%
associate-*l/81.1%
expm1-log1p-u81.1%
associate-*l/81.1%
associate-*r/81.1%
div-inv81.1%
metadata-eval81.1%
Applied egg-rr81.1%
Taylor expanded in angle around 0 80.8%
Taylor expanded in angle around 0 78.0%
*-commutative78.0%
Simplified78.0%
Final simplification60.2%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= b 1.9e+31) (pow (* a (sin (/ angle_m (/ 180.0 PI)))) 2.0) (* b b)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (b <= 1.9e+31) {
tmp = pow((a * sin((angle_m / (180.0 / ((double) M_PI))))), 2.0);
} else {
tmp = b * b;
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (b <= 1.9e+31) {
tmp = Math.pow((a * Math.sin((angle_m / (180.0 / Math.PI)))), 2.0);
} else {
tmp = b * b;
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): tmp = 0 if b <= 1.9e+31: tmp = math.pow((a * math.sin((angle_m / (180.0 / math.pi)))), 2.0) else: tmp = b * b return tmp
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (b <= 1.9e+31) tmp = Float64(a * sin(Float64(angle_m / Float64(180.0 / pi)))) ^ 2.0; else tmp = Float64(b * b); end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) tmp = 0.0; if (b <= 1.9e+31) tmp = (a * sin((angle_m / (180.0 / pi)))) ^ 2.0; else tmp = b * b; end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[b, 1.9e+31], N[Power[N[(a * N[Sin[N[(angle$95$m / N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(b * b), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.9 \cdot 10^{+31}:\\
\;\;\;\;{\left(a \cdot \sin \left(\frac{angle\_m}{\frac{180}{\pi}}\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;b \cdot b\\
\end{array}
\end{array}
if b < 1.9000000000000001e31Initial program 80.9%
associate-*l/81.0%
Applied egg-rr81.0%
Taylor expanded in a around inf 42.9%
unpow242.9%
*-commutative42.9%
associate-*r*42.9%
unpow242.9%
swap-sqr48.7%
unpow248.7%
associate-*r*48.6%
*-commutative48.6%
associate-*r*48.7%
*-commutative48.7%
metadata-eval48.7%
associate-/l*48.6%
*-rgt-identity48.6%
associate-/r/48.7%
Simplified48.7%
if 1.9000000000000001e31 < b Initial program 87.2%
associate-*l/87.3%
associate-/l*87.2%
cos-neg87.2%
distribute-lft-neg-out87.2%
distribute-frac-neg87.2%
distribute-frac-neg87.2%
distribute-lft-neg-out87.2%
cos-neg87.2%
associate-*l/87.2%
associate-/l*87.4%
Simplified87.4%
Taylor expanded in angle around 0 82.0%
unpow282.0%
Applied egg-rr82.0%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= b 3.3e+31) (pow (* a (sin (* PI (* angle_m 0.005555555555555556)))) 2.0) (* b b)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (b <= 3.3e+31) {
tmp = pow((a * sin((((double) M_PI) * (angle_m * 0.005555555555555556)))), 2.0);
} else {
tmp = b * b;
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (b <= 3.3e+31) {
tmp = Math.pow((a * Math.sin((Math.PI * (angle_m * 0.005555555555555556)))), 2.0);
} else {
tmp = b * b;
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): tmp = 0 if b <= 3.3e+31: tmp = math.pow((a * math.sin((math.pi * (angle_m * 0.005555555555555556)))), 2.0) else: tmp = b * b return tmp
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (b <= 3.3e+31) tmp = Float64(a * sin(Float64(pi * Float64(angle_m * 0.005555555555555556)))) ^ 2.0; else tmp = Float64(b * b); end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) tmp = 0.0; if (b <= 3.3e+31) tmp = (a * sin((pi * (angle_m * 0.005555555555555556)))) ^ 2.0; else tmp = b * b; end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[b, 3.3e+31], N[Power[N[(a * N[Sin[N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(b * b), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;b \leq 3.3 \cdot 10^{+31}:\\
\;\;\;\;{\left(a \cdot \sin \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;b \cdot b\\
\end{array}
\end{array}
if b < 3.29999999999999992e31Initial program 80.9%
associate-*l/81.0%
associate-/l*81.0%
cos-neg81.0%
distribute-lft-neg-out81.0%
distribute-frac-neg81.0%
distribute-frac-neg81.0%
distribute-lft-neg-out81.0%
cos-neg81.0%
associate-*l/81.0%
associate-/l*80.9%
Simplified80.9%
Taylor expanded in a around inf 42.9%
unpow242.9%
*-commutative42.9%
associate-*r*42.9%
unpow242.9%
swap-sqr48.7%
unpow248.7%
associate-*r*48.6%
*-commutative48.6%
associate-*r*48.7%
Simplified48.7%
if 3.29999999999999992e31 < b Initial program 87.2%
associate-*l/87.3%
associate-/l*87.2%
cos-neg87.2%
distribute-lft-neg-out87.2%
distribute-frac-neg87.2%
distribute-frac-neg87.2%
distribute-lft-neg-out87.2%
cos-neg87.2%
associate-*l/87.2%
associate-/l*87.4%
Simplified87.4%
Taylor expanded in angle around 0 82.0%
unpow282.0%
Applied egg-rr82.0%
Final simplification56.1%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= b 2.7e+32) (pow (* a (sin (* 0.005555555555555556 (* angle_m PI)))) 2.0) (* b b)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (b <= 2.7e+32) {
tmp = pow((a * sin((0.005555555555555556 * (angle_m * ((double) M_PI))))), 2.0);
} else {
tmp = b * b;
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (b <= 2.7e+32) {
tmp = Math.pow((a * Math.sin((0.005555555555555556 * (angle_m * Math.PI)))), 2.0);
} else {
tmp = b * b;
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): tmp = 0 if b <= 2.7e+32: tmp = math.pow((a * math.sin((0.005555555555555556 * (angle_m * math.pi)))), 2.0) else: tmp = b * b return tmp
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (b <= 2.7e+32) tmp = Float64(a * sin(Float64(0.005555555555555556 * Float64(angle_m * pi)))) ^ 2.0; else tmp = Float64(b * b); end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) tmp = 0.0; if (b <= 2.7e+32) tmp = (a * sin((0.005555555555555556 * (angle_m * pi)))) ^ 2.0; else tmp = b * b; end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[b, 2.7e+32], N[Power[N[(a * N[Sin[N[(0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(b * b), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.7 \cdot 10^{+32}:\\
\;\;\;\;{\left(a \cdot \sin \left(0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;b \cdot b\\
\end{array}
\end{array}
if b < 2.70000000000000013e32Initial program 80.9%
associate-*l/81.0%
associate-/l*81.0%
cos-neg81.0%
distribute-lft-neg-out81.0%
distribute-frac-neg81.0%
distribute-frac-neg81.0%
distribute-lft-neg-out81.0%
cos-neg81.0%
associate-*l/81.0%
associate-/l*80.9%
Simplified80.9%
Taylor expanded in a around inf 42.9%
unpow242.9%
*-commutative42.9%
associate-*r*42.9%
unpow242.9%
swap-sqr48.7%
unpow248.7%
associate-*r*48.6%
*-commutative48.6%
Simplified48.6%
if 2.70000000000000013e32 < b Initial program 87.2%
associate-*l/87.3%
associate-/l*87.2%
cos-neg87.2%
distribute-lft-neg-out87.2%
distribute-frac-neg87.2%
distribute-frac-neg87.2%
distribute-lft-neg-out87.2%
cos-neg87.2%
associate-*l/87.2%
associate-/l*87.4%
Simplified87.4%
Taylor expanded in angle around 0 82.0%
unpow282.0%
Applied egg-rr82.0%
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}
Initial program 82.3%
associate-*l/82.4%
associate-/l*82.4%
cos-neg82.4%
distribute-lft-neg-out82.4%
distribute-frac-neg82.4%
distribute-frac-neg82.4%
distribute-lft-neg-out82.4%
cos-neg82.4%
associate-*l/82.4%
associate-/l*82.3%
Simplified82.3%
Taylor expanded in angle around 0 57.8%
unpow257.8%
Applied egg-rr57.8%
herbie shell --seed 2024136
(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)))