
(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:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(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}
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(+
(pow
(*
a
(fma
(cos (+ 1.0 (* 0.005555555555555556 (* angle_m PI))))
(cos 1.0)
(*
(+
(exp (log1p (sin (fma angle_m (* 0.005555555555555556 PI) 1.0))))
-1.0)
(sin 1.0))))
2.0)
(pow (* b (sin (* PI (* 0.005555555555555556 angle_m)))) 2.0)))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((a * fma(cos((1.0 + (0.005555555555555556 * (angle_m * ((double) M_PI))))), cos(1.0), ((exp(log1p(sin(fma(angle_m, (0.005555555555555556 * ((double) M_PI)), 1.0)))) + -1.0) * sin(1.0)))), 2.0) + pow((b * sin((((double) M_PI) * (0.005555555555555556 * angle_m)))), 2.0);
}
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(a * fma(cos(Float64(1.0 + Float64(0.005555555555555556 * Float64(angle_m * pi)))), cos(1.0), Float64(Float64(exp(log1p(sin(fma(angle_m, Float64(0.005555555555555556 * pi), 1.0)))) + -1.0) * sin(1.0)))) ^ 2.0) + (Float64(b * sin(Float64(pi * Float64(0.005555555555555556 * angle_m)))) ^ 2.0)) end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[N[(a * N[(N[Cos[N[(1.0 + N[(0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[1.0], $MachinePrecision] + N[(N[(N[Exp[N[Log[1 + N[Sin[N[(angle$95$m * N[(0.005555555555555556 * Pi), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + -1.0), $MachinePrecision] * N[Sin[1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(Pi * N[(0.005555555555555556 * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(a \cdot \mathsf{fma}\left(\cos \left(1 + 0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\right), \cos 1, \left(e^{\mathsf{log1p}\left(\sin \left(\mathsf{fma}\left(angle\_m, 0.005555555555555556 \cdot \pi, 1\right)\right)\right)} + -1\right) \cdot \sin 1\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\_m\right)\right)\right)}^{2}
\end{array}
Initial program 82.9%
Simplified83.0%
metadata-eval83.0%
div-inv83.0%
expm1-log1p-u67.2%
expm1-undefine67.2%
cos-diff67.5%
div-inv67.5%
metadata-eval67.5%
div-inv67.5%
metadata-eval67.5%
Applied egg-rr67.5%
fma-define67.4%
log1p-undefine67.4%
rem-exp-log67.5%
associate-*r*67.4%
*-commutative67.4%
associate-*r*67.4%
log1p-undefine67.4%
rem-exp-log82.9%
associate-*r*82.9%
*-commutative82.9%
associate-*r*82.9%
Simplified82.9%
Taylor expanded in angle around inf 82.9%
expm1-log1p-u82.9%
expm1-undefine82.9%
+-commutative82.9%
fma-define82.9%
Applied egg-rr82.9%
Final simplification82.9%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(+
(pow (* b (sin (* PI (* 0.005555555555555556 angle_m)))) 2.0)
(pow
(*
a
(fma
(cos (+ 1.0 (* 0.005555555555555556 (* angle_m PI))))
(cos 1.0)
(* (sin 1.0) (sin (+ 1.0 (* angle_m (* 0.005555555555555556 PI)))))))
2.0)))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((b * sin((((double) M_PI) * (0.005555555555555556 * angle_m)))), 2.0) + pow((a * fma(cos((1.0 + (0.005555555555555556 * (angle_m * ((double) M_PI))))), cos(1.0), (sin(1.0) * sin((1.0 + (angle_m * (0.005555555555555556 * ((double) M_PI)))))))), 2.0);
}
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(b * sin(Float64(pi * Float64(0.005555555555555556 * angle_m)))) ^ 2.0) + (Float64(a * fma(cos(Float64(1.0 + Float64(0.005555555555555556 * Float64(angle_m * pi)))), cos(1.0), Float64(sin(1.0) * sin(Float64(1.0 + Float64(angle_m * Float64(0.005555555555555556 * pi))))))) ^ 2.0)) end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[N[(b * N[Sin[N[(Pi * N[(0.005555555555555556 * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[(N[Cos[N[(1.0 + N[(0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[1.0], $MachinePrecision] + N[(N[Sin[1.0], $MachinePrecision] * N[Sin[N[(1.0 + N[(angle$95$m * N[(0.005555555555555556 * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(b \cdot \sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\_m\right)\right)\right)}^{2} + {\left(a \cdot \mathsf{fma}\left(\cos \left(1 + 0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\right), \cos 1, \sin 1 \cdot \sin \left(1 + angle\_m \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)\right)}^{2}
\end{array}
Initial program 82.9%
Simplified83.0%
metadata-eval83.0%
div-inv83.0%
expm1-log1p-u67.2%
expm1-undefine67.2%
cos-diff67.5%
div-inv67.5%
metadata-eval67.5%
div-inv67.5%
metadata-eval67.5%
Applied egg-rr67.5%
fma-define67.4%
log1p-undefine67.4%
rem-exp-log67.5%
associate-*r*67.4%
*-commutative67.4%
associate-*r*67.4%
log1p-undefine67.4%
rem-exp-log82.9%
associate-*r*82.9%
*-commutative82.9%
associate-*r*82.9%
Simplified82.9%
Taylor expanded in angle around inf 82.9%
Final simplification82.9%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(let* ((t_0 (+ 1.0 (* 0.005555555555555556 (* angle_m PI)))))
(+
(pow (* b (sin (* PI (* 0.005555555555555556 angle_m)))) 2.0)
(pow (* a (fma (cos t_0) (cos 1.0) (* (sin 1.0) (sin t_0)))) 2.0))))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double t_0 = 1.0 + (0.005555555555555556 * (angle_m * ((double) M_PI)));
return pow((b * sin((((double) M_PI) * (0.005555555555555556 * angle_m)))), 2.0) + pow((a * fma(cos(t_0), cos(1.0), (sin(1.0) * sin(t_0)))), 2.0);
}
angle_m = abs(angle) function code(a, b, angle_m) t_0 = Float64(1.0 + Float64(0.005555555555555556 * Float64(angle_m * pi))) return Float64((Float64(b * sin(Float64(pi * Float64(0.005555555555555556 * angle_m)))) ^ 2.0) + (Float64(a * fma(cos(t_0), cos(1.0), Float64(sin(1.0) * sin(t_0)))) ^ 2.0)) end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[(1.0 + N[(0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[N[(b * N[Sin[N[(Pi * N[(0.005555555555555556 * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[(N[Cos[t$95$0], $MachinePrecision] * N[Cos[1.0], $MachinePrecision] + N[(N[Sin[1.0], $MachinePrecision] * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := 1 + 0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\\
{\left(b \cdot \sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\_m\right)\right)\right)}^{2} + {\left(a \cdot \mathsf{fma}\left(\cos t\_0, \cos 1, \sin 1 \cdot \sin t\_0\right)\right)}^{2}
\end{array}
\end{array}
Initial program 82.9%
Simplified83.0%
metadata-eval83.0%
div-inv83.0%
expm1-log1p-u67.2%
expm1-undefine67.2%
cos-diff67.5%
div-inv67.5%
metadata-eval67.5%
div-inv67.5%
metadata-eval67.5%
Applied egg-rr67.5%
fma-define67.4%
log1p-undefine67.4%
rem-exp-log67.5%
associate-*r*67.4%
*-commutative67.4%
associate-*r*67.4%
log1p-undefine67.4%
rem-exp-log82.9%
associate-*r*82.9%
*-commutative82.9%
associate-*r*82.9%
Simplified82.9%
Taylor expanded in angle around inf 82.9%
Taylor expanded in angle around inf 83.0%
Final simplification83.0%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (let* ((t_0 (* PI (* 0.005555555555555556 angle_m)))) (pow (hypot (* a (cos t_0)) (* b (sin t_0))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double t_0 = ((double) M_PI) * (0.005555555555555556 * angle_m);
return pow(hypot((a * cos(t_0)), (b * sin(t_0))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double t_0 = Math.PI * (0.005555555555555556 * angle_m);
return Math.pow(Math.hypot((a * Math.cos(t_0)), (b * Math.sin(t_0))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): t_0 = math.pi * (0.005555555555555556 * angle_m) return math.pow(math.hypot((a * math.cos(t_0)), (b * math.sin(t_0))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) t_0 = Float64(pi * Float64(0.005555555555555556 * angle_m)) return hypot(Float64(a * cos(t_0)), Float64(b * sin(t_0))) ^ 2.0 end
angle_m = abs(angle); function tmp = code(a, b, angle_m) t_0 = pi * (0.005555555555555556 * angle_m); tmp = hypot((a * cos(t_0)), (b * sin(t_0))) ^ 2.0; end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[(Pi * N[(0.005555555555555556 * angle$95$m), $MachinePrecision]), $MachinePrecision]}, N[Power[N[Sqrt[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision] ^ 2 + N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := \pi \cdot \left(0.005555555555555556 \cdot angle\_m\right)\\
{\left(\mathsf{hypot}\left(a \cdot \cos t\_0, b \cdot \sin t\_0\right)\right)}^{2}
\end{array}
\end{array}
Initial program 82.9%
Simplified83.0%
Applied egg-rr83.0%
Final simplification83.0%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* b (sin (* PI (* 0.005555555555555556 angle_m)))) 2.0) (pow a 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((b * sin((((double) M_PI) * (0.005555555555555556 * angle_m)))), 2.0) + pow(a, 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow((b * Math.sin((Math.PI * (0.005555555555555556 * angle_m)))), 2.0) + Math.pow(a, 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow((b * math.sin((math.pi * (0.005555555555555556 * angle_m)))), 2.0) + math.pow(a, 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(b * sin(Float64(pi * Float64(0.005555555555555556 * angle_m)))) ^ 2.0) + (a ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((b * sin((pi * (0.005555555555555556 * angle_m)))) ^ 2.0) + (a ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[N[(b * N[Sin[N[(Pi * N[(0.005555555555555556 * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(b \cdot \sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\_m\right)\right)\right)}^{2} + {a}^{2}
\end{array}
Initial program 82.9%
Simplified83.0%
Taylor expanded in angle around 0 82.5%
Final simplification82.5%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= a 2.5e-99) (pow (* b (sin (* PI (* 0.005555555555555556 angle_m)))) 2.0) (* a a)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (a <= 2.5e-99) {
tmp = pow((b * sin((((double) M_PI) * (0.005555555555555556 * angle_m)))), 2.0);
} else {
tmp = a * a;
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (a <= 2.5e-99) {
tmp = Math.pow((b * Math.sin((Math.PI * (0.005555555555555556 * angle_m)))), 2.0);
} else {
tmp = a * a;
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): tmp = 0 if a <= 2.5e-99: tmp = math.pow((b * math.sin((math.pi * (0.005555555555555556 * angle_m)))), 2.0) else: tmp = a * a return tmp
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (a <= 2.5e-99) tmp = Float64(b * sin(Float64(pi * Float64(0.005555555555555556 * angle_m)))) ^ 2.0; else tmp = Float64(a * a); end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) tmp = 0.0; if (a <= 2.5e-99) tmp = (b * sin((pi * (0.005555555555555556 * angle_m)))) ^ 2.0; else tmp = a * a; end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[a, 2.5e-99], N[Power[N[(b * N[Sin[N[(Pi * N[(0.005555555555555556 * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(a * a), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;a \leq 2.5 \cdot 10^{-99}:\\
\;\;\;\;{\left(b \cdot \sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\_m\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;a \cdot a\\
\end{array}
\end{array}
if a < 2.49999999999999985e-99Initial program 85.6%
Simplified85.6%
metadata-eval85.6%
div-inv85.6%
clear-num85.6%
un-div-inv85.6%
Applied egg-rr85.6%
Taylor expanded in a around 0 46.3%
Simplified52.4%
if 2.49999999999999985e-99 < a Initial program 78.2%
Simplified78.2%
Taylor expanded in angle around 0 70.5%
unpow270.5%
Applied egg-rr70.5%
Final simplification58.9%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= a 2.6e-99) (pow (* b (sin (* angle_m (* 0.005555555555555556 PI)))) 2.0) (* a a)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (a <= 2.6e-99) {
tmp = pow((b * sin((angle_m * (0.005555555555555556 * ((double) M_PI))))), 2.0);
} else {
tmp = a * a;
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (a <= 2.6e-99) {
tmp = Math.pow((b * Math.sin((angle_m * (0.005555555555555556 * Math.PI)))), 2.0);
} else {
tmp = a * a;
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): tmp = 0 if a <= 2.6e-99: tmp = math.pow((b * math.sin((angle_m * (0.005555555555555556 * math.pi)))), 2.0) else: tmp = a * a return tmp
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (a <= 2.6e-99) tmp = Float64(b * sin(Float64(angle_m * Float64(0.005555555555555556 * pi)))) ^ 2.0; else tmp = Float64(a * a); end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) tmp = 0.0; if (a <= 2.6e-99) tmp = (b * sin((angle_m * (0.005555555555555556 * pi)))) ^ 2.0; else tmp = a * a; end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[a, 2.6e-99], N[Power[N[(b * N[Sin[N[(angle$95$m * N[(0.005555555555555556 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(a * a), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;a \leq 2.6 \cdot 10^{-99}:\\
\;\;\;\;{\left(b \cdot \sin \left(angle\_m \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;a \cdot a\\
\end{array}
\end{array}
if a < 2.60000000000000005e-99Initial program 85.6%
Simplified85.6%
Taylor expanded in a around 0 46.3%
*-commutative46.3%
*-commutative46.3%
*-commutative46.3%
associate-*r*46.2%
unpow246.2%
unpow246.2%
swap-sqr52.4%
unpow252.4%
*-commutative52.4%
associate-*r*52.4%
*-commutative52.4%
associate-*r*52.4%
Simplified52.4%
if 2.60000000000000005e-99 < a Initial program 78.2%
Simplified78.2%
Taylor expanded in angle around 0 70.5%
unpow270.5%
Applied egg-rr70.5%
Final simplification58.9%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= b 2.3e+163) (* a a) (cbrt (pow a 6.0))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (b <= 2.3e+163) {
tmp = a * a;
} else {
tmp = cbrt(pow(a, 6.0));
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (b <= 2.3e+163) {
tmp = a * a;
} else {
tmp = Math.cbrt(Math.pow(a, 6.0));
}
return tmp;
}
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (b <= 2.3e+163) tmp = Float64(a * a); else tmp = cbrt((a ^ 6.0)); end return tmp end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[b, 2.3e+163], N[(a * a), $MachinePrecision], N[Power[N[Power[a, 6.0], $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.3 \cdot 10^{+163}:\\
\;\;\;\;a \cdot a\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{a}^{6}}\\
\end{array}
\end{array}
if b < 2.30000000000000002e163Initial program 81.1%
Simplified81.1%
Taylor expanded in angle around 0 64.8%
unpow264.8%
Applied egg-rr64.8%
if 2.30000000000000002e163 < b Initial program 99.5%
Simplified99.6%
Taylor expanded in angle around 0 38.2%
add-sqr-sqrt38.2%
sqrt-unprod41.9%
pow-prod-up41.9%
metadata-eval41.9%
Applied egg-rr41.9%
add-cbrt-cube45.7%
pow1/345.7%
add-sqr-sqrt45.7%
sqrt-pow145.7%
metadata-eval45.7%
pow-prod-up45.7%
metadata-eval45.7%
Applied egg-rr45.7%
unpow1/345.7%
Simplified45.7%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (* a a))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return a * a;
}
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 = a * a
end function
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return a * a;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return a * a
angle_m = abs(angle) function code(a, b, angle_m) return Float64(a * a) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = a * a; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(a * a), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
a \cdot a
\end{array}
Initial program 82.9%
Simplified83.0%
Taylor expanded in angle around 0 62.2%
unpow262.2%
Applied egg-rr62.2%
herbie shell --seed 2024118
(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)))