
(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 8 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}
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b angle_m)
:precision binary64
(*
angle_s
(*
(*
(* 2.0 (* (+ b a) (- b a)))
(sin (expm1 (log1p (* PI (* angle_m 0.005555555555555556))))))
(cos (* PI (/ angle_m 180.0))))))angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
return angle_s * (((2.0 * ((b + a) * (b - a))) * sin(expm1(log1p((((double) M_PI) * (angle_m * 0.005555555555555556)))))) * cos((((double) M_PI) * (angle_m / 180.0))));
}
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
return angle_s * (((2.0 * ((b + a) * (b - a))) * Math.sin(Math.expm1(Math.log1p((Math.PI * (angle_m * 0.005555555555555556)))))) * Math.cos((Math.PI * (angle_m / 180.0))));
}
angle_m = math.fabs(angle) angle_s = math.copysign(1.0, angle) def code(angle_s, a, b, angle_m): return angle_s * (((2.0 * ((b + a) * (b - a))) * math.sin(math.expm1(math.log1p((math.pi * (angle_m * 0.005555555555555556)))))) * math.cos((math.pi * (angle_m / 180.0))))
angle_m = abs(angle) angle_s = copysign(1.0, angle) function code(angle_s, a, b, angle_m) return Float64(angle_s * Float64(Float64(Float64(2.0 * Float64(Float64(b + a) * Float64(b - a))) * sin(expm1(log1p(Float64(pi * Float64(angle_m * 0.005555555555555556)))))) * cos(Float64(pi * Float64(angle_m / 180.0))))) end
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_, b_, angle$95$m_] := N[(angle$95$s * N[(N[(N[(2.0 * N[(N[(b + a), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(Exp[N[Log[1 + N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)
\\
angle_s \cdot \left(\left(\left(2 \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)\right) \cdot \sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\pi \cdot \left(angle_m \cdot 0.005555555555555556\right)\right)\right)\right)\right) \cdot \cos \left(\pi \cdot \frac{angle_m}{180}\right)\right)
\end{array}
Initial program 57.0%
unpow257.0%
unpow257.0%
difference-of-squares60.6%
Applied egg-rr60.6%
div-inv62.2%
metadata-eval62.2%
expm1-log1p-u54.2%
Applied egg-rr54.2%
Final simplification54.2%
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b angle_m)
:precision binary64
(let* ((t_0 (* 2.0 (* (+ b a) (- b a))))
(t_1 (* 0.005555555555555556 (* PI angle_m))))
(*
angle_s
(if (<= (- (pow b 2.0) (pow a 2.0)) 2e+305)
(* (* t_0 (sin t_1)) (cos t_1))
(*
t_0
(sin (pow (cbrt (* PI (* angle_m 0.005555555555555556))) 3.0)))))))angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
double t_0 = 2.0 * ((b + a) * (b - a));
double t_1 = 0.005555555555555556 * (((double) M_PI) * angle_m);
double tmp;
if ((pow(b, 2.0) - pow(a, 2.0)) <= 2e+305) {
tmp = (t_0 * sin(t_1)) * cos(t_1);
} else {
tmp = t_0 * sin(pow(cbrt((((double) M_PI) * (angle_m * 0.005555555555555556))), 3.0));
}
return angle_s * tmp;
}
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
double t_0 = 2.0 * ((b + a) * (b - a));
double t_1 = 0.005555555555555556 * (Math.PI * angle_m);
double tmp;
if ((Math.pow(b, 2.0) - Math.pow(a, 2.0)) <= 2e+305) {
tmp = (t_0 * Math.sin(t_1)) * Math.cos(t_1);
} else {
tmp = t_0 * Math.sin(Math.pow(Math.cbrt((Math.PI * (angle_m * 0.005555555555555556))), 3.0));
}
return angle_s * tmp;
}
angle_m = abs(angle) angle_s = copysign(1.0, angle) function code(angle_s, a, b, angle_m) t_0 = Float64(2.0 * Float64(Float64(b + a) * Float64(b - a))) t_1 = Float64(0.005555555555555556 * Float64(pi * angle_m)) tmp = 0.0 if (Float64((b ^ 2.0) - (a ^ 2.0)) <= 2e+305) tmp = Float64(Float64(t_0 * sin(t_1)) * cos(t_1)); else tmp = Float64(t_0 * sin((cbrt(Float64(pi * Float64(angle_m * 0.005555555555555556))) ^ 3.0))); end return Float64(angle_s * tmp) end
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_, b_, angle$95$m_] := Block[{t$95$0 = N[(2.0 * N[(N[(b + a), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.005555555555555556 * N[(Pi * angle$95$m), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision], 2e+305], N[(N[(t$95$0 * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[Sin[N[Power[N[Power[N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)
\\
\begin{array}{l}
t_0 := 2 \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)\\
t_1 := 0.005555555555555556 \cdot \left(\pi \cdot angle_m\right)\\
angle_s \cdot \begin{array}{l}
\mathbf{if}\;{b}^{2} - {a}^{2} \leq 2 \cdot 10^{+305}:\\
\;\;\;\;\left(t_0 \cdot \sin t_1\right) \cdot \cos t_1\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \sin \left({\left(\sqrt[3]{\pi \cdot \left(angle_m \cdot 0.005555555555555556\right)}\right)}^{3}\right)\\
\end{array}
\end{array}
\end{array}
if (-.f64 (pow.f64 b 2) (pow.f64 a 2)) < 1.9999999999999999e305Initial program 64.5%
unpow264.5%
unpow264.5%
difference-of-squares64.5%
Applied egg-rr64.5%
Taylor expanded in angle around 0 64.5%
Taylor expanded in angle around inf 65.6%
if 1.9999999999999999e305 < (-.f64 (pow.f64 b 2) (pow.f64 a 2)) Initial program 37.8%
unpow237.8%
unpow237.8%
difference-of-squares50.4%
Applied egg-rr50.4%
Taylor expanded in angle around 0 52.1%
add-cube-cbrt56.3%
pow361.8%
div-inv61.8%
metadata-eval61.8%
Applied egg-rr61.8%
Final simplification64.5%
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b angle_m)
:precision binary64
(*
angle_s
(*
(cos (* PI (/ angle_m 180.0)))
(*
(* 2.0 (* (+ b a) (- b a)))
(sin (exp (log (* PI (* angle_m 0.005555555555555556)))))))))angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
return angle_s * (cos((((double) M_PI) * (angle_m / 180.0))) * ((2.0 * ((b + a) * (b - a))) * sin(exp(log((((double) M_PI) * (angle_m * 0.005555555555555556)))))));
}
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
return angle_s * (Math.cos((Math.PI * (angle_m / 180.0))) * ((2.0 * ((b + a) * (b - a))) * Math.sin(Math.exp(Math.log((Math.PI * (angle_m * 0.005555555555555556)))))));
}
angle_m = math.fabs(angle) angle_s = math.copysign(1.0, angle) def code(angle_s, a, b, angle_m): return angle_s * (math.cos((math.pi * (angle_m / 180.0))) * ((2.0 * ((b + a) * (b - a))) * math.sin(math.exp(math.log((math.pi * (angle_m * 0.005555555555555556)))))))
angle_m = abs(angle) angle_s = copysign(1.0, angle) function code(angle_s, a, b, angle_m) return Float64(angle_s * Float64(cos(Float64(pi * Float64(angle_m / 180.0))) * Float64(Float64(2.0 * Float64(Float64(b + a) * Float64(b - a))) * sin(exp(log(Float64(pi * Float64(angle_m * 0.005555555555555556)))))))) end
angle_m = abs(angle); angle_s = sign(angle) * abs(1.0); function tmp = code(angle_s, a, b, angle_m) tmp = angle_s * (cos((pi * (angle_m / 180.0))) * ((2.0 * ((b + a) * (b - a))) * sin(exp(log((pi * (angle_m * 0.005555555555555556))))))); end
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_, b_, angle$95$m_] := N[(angle$95$s * N[(N[Cos[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(2.0 * N[(N[(b + a), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[N[Exp[N[Log[N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)
\\
angle_s \cdot \left(\cos \left(\pi \cdot \frac{angle_m}{180}\right) \cdot \left(\left(2 \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)\right) \cdot \sin \left(e^{\log \left(\pi \cdot \left(angle_m \cdot 0.005555555555555556\right)\right)}\right)\right)\right)
\end{array}
Initial program 57.0%
unpow257.0%
unpow257.0%
difference-of-squares60.6%
Applied egg-rr60.6%
div-inv62.2%
metadata-eval62.2%
add-exp-log30.2%
Applied egg-rr30.2%
Final simplification30.2%
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b angle_m)
:precision binary64
(let* ((t_0 (* PI (* angle_m 0.005555555555555556))))
(*
angle_s
(* (* (* 2.0 (* (+ b a) (- b a))) (sin (expm1 (log1p t_0)))) (cos t_0)))))angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
double t_0 = ((double) M_PI) * (angle_m * 0.005555555555555556);
return angle_s * (((2.0 * ((b + a) * (b - a))) * sin(expm1(log1p(t_0)))) * cos(t_0));
}
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
double t_0 = Math.PI * (angle_m * 0.005555555555555556);
return angle_s * (((2.0 * ((b + a) * (b - a))) * Math.sin(Math.expm1(Math.log1p(t_0)))) * Math.cos(t_0));
}
angle_m = math.fabs(angle) angle_s = math.copysign(1.0, angle) def code(angle_s, a, b, angle_m): t_0 = math.pi * (angle_m * 0.005555555555555556) return angle_s * (((2.0 * ((b + a) * (b - a))) * math.sin(math.expm1(math.log1p(t_0)))) * math.cos(t_0))
angle_m = abs(angle) angle_s = copysign(1.0, angle) function code(angle_s, a, b, angle_m) t_0 = Float64(pi * Float64(angle_m * 0.005555555555555556)) return Float64(angle_s * Float64(Float64(Float64(2.0 * Float64(Float64(b + a) * Float64(b - a))) * sin(expm1(log1p(t_0)))) * cos(t_0))) end
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_, b_, angle$95$m_] := Block[{t$95$0 = N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * N[(N[(N[(2.0 * N[(N[(b + a), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(Exp[N[Log[1 + t$95$0], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)
\\
\begin{array}{l}
t_0 := \pi \cdot \left(angle_m \cdot 0.005555555555555556\right)\\
angle_s \cdot \left(\left(\left(2 \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)\right) \cdot \sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(t_0\right)\right)\right)\right) \cdot \cos t_0\right)
\end{array}
\end{array}
Initial program 57.0%
unpow257.0%
unpow257.0%
difference-of-squares60.6%
Applied egg-rr60.6%
div-inv62.2%
metadata-eval62.2%
expm1-log1p-u54.2%
Applied egg-rr54.2%
Taylor expanded in angle around inf 54.2%
associate-*r*54.1%
*-commutative54.1%
*-commutative54.1%
*-commutative54.1%
Simplified54.1%
Final simplification54.1%
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b angle_m)
:precision binary64
(let* ((t_0 (* PI (* angle_m 0.005555555555555556)))
(t_1 (* 2.0 (* (+ b a) (- b a)))))
(*
angle_s
(if (<= b 1.05e+188)
(* t_1 (sin t_0))
(* t_1 (sin (pow (cbrt t_0) 3.0)))))))angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
double t_0 = ((double) M_PI) * (angle_m * 0.005555555555555556);
double t_1 = 2.0 * ((b + a) * (b - a));
double tmp;
if (b <= 1.05e+188) {
tmp = t_1 * sin(t_0);
} else {
tmp = t_1 * sin(pow(cbrt(t_0), 3.0));
}
return angle_s * tmp;
}
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
double t_0 = Math.PI * (angle_m * 0.005555555555555556);
double t_1 = 2.0 * ((b + a) * (b - a));
double tmp;
if (b <= 1.05e+188) {
tmp = t_1 * Math.sin(t_0);
} else {
tmp = t_1 * Math.sin(Math.pow(Math.cbrt(t_0), 3.0));
}
return angle_s * tmp;
}
angle_m = abs(angle) angle_s = copysign(1.0, angle) function code(angle_s, a, b, angle_m) t_0 = Float64(pi * Float64(angle_m * 0.005555555555555556)) t_1 = Float64(2.0 * Float64(Float64(b + a) * Float64(b - a))) tmp = 0.0 if (b <= 1.05e+188) tmp = Float64(t_1 * sin(t_0)); else tmp = Float64(t_1 * sin((cbrt(t_0) ^ 3.0))); end return Float64(angle_s * tmp) end
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_, b_, angle$95$m_] := Block[{t$95$0 = N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[(N[(b + a), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[b, 1.05e+188], N[(t$95$1 * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Sin[N[Power[N[Power[t$95$0, 1/3], $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)
\\
\begin{array}{l}
t_0 := \pi \cdot \left(angle_m \cdot 0.005555555555555556\right)\\
t_1 := 2 \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)\\
angle_s \cdot \begin{array}{l}
\mathbf{if}\;b \leq 1.05 \cdot 10^{+188}:\\
\;\;\;\;t_1 \cdot \sin t_0\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \sin \left({\left(\sqrt[3]{t_0}\right)}^{3}\right)\\
\end{array}
\end{array}
\end{array}
if b < 1.04999999999999993e188Initial program 57.3%
unpow257.3%
unpow257.3%
difference-of-squares60.0%
Applied egg-rr60.0%
Taylor expanded in angle around 0 60.8%
Taylor expanded in angle around inf 60.1%
associate-*r*60.9%
*-commutative60.9%
*-commutative60.9%
*-commutative60.9%
Simplified60.9%
if 1.04999999999999993e188 < b Initial program 54.3%
unpow254.3%
unpow254.3%
difference-of-squares65.1%
Applied egg-rr65.1%
Taylor expanded in angle around 0 65.1%
add-cube-cbrt72.2%
pow382.9%
div-inv79.3%
metadata-eval79.3%
Applied egg-rr79.3%
Final simplification62.9%
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b angle_m)
:precision binary64
(*
angle_s
(if (<= b 2.7e+187)
(*
(* 2.0 (* (+ b a) (- b a)))
(sin (* 0.005555555555555556 (* PI angle_m))))
(* 0.011111111111111112 (* (pow b 2.0) (* PI angle_m))))))angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
double tmp;
if (b <= 2.7e+187) {
tmp = (2.0 * ((b + a) * (b - a))) * sin((0.005555555555555556 * (((double) M_PI) * angle_m)));
} else {
tmp = 0.011111111111111112 * (pow(b, 2.0) * (((double) M_PI) * angle_m));
}
return angle_s * tmp;
}
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
double tmp;
if (b <= 2.7e+187) {
tmp = (2.0 * ((b + a) * (b - a))) * Math.sin((0.005555555555555556 * (Math.PI * angle_m)));
} else {
tmp = 0.011111111111111112 * (Math.pow(b, 2.0) * (Math.PI * angle_m));
}
return angle_s * tmp;
}
angle_m = math.fabs(angle) angle_s = math.copysign(1.0, angle) def code(angle_s, a, b, angle_m): tmp = 0 if b <= 2.7e+187: tmp = (2.0 * ((b + a) * (b - a))) * math.sin((0.005555555555555556 * (math.pi * angle_m))) else: tmp = 0.011111111111111112 * (math.pow(b, 2.0) * (math.pi * angle_m)) return angle_s * tmp
angle_m = abs(angle) angle_s = copysign(1.0, angle) function code(angle_s, a, b, angle_m) tmp = 0.0 if (b <= 2.7e+187) tmp = Float64(Float64(2.0 * Float64(Float64(b + a) * Float64(b - a))) * sin(Float64(0.005555555555555556 * Float64(pi * angle_m)))); else tmp = Float64(0.011111111111111112 * Float64((b ^ 2.0) * Float64(pi * angle_m))); end return Float64(angle_s * tmp) end
angle_m = abs(angle); angle_s = sign(angle) * abs(1.0); function tmp_2 = code(angle_s, a, b, angle_m) tmp = 0.0; if (b <= 2.7e+187) tmp = (2.0 * ((b + a) * (b - a))) * sin((0.005555555555555556 * (pi * angle_m))); else tmp = 0.011111111111111112 * ((b ^ 2.0) * (pi * angle_m)); end tmp_2 = angle_s * tmp; end
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_, b_, angle$95$m_] := N[(angle$95$s * If[LessEqual[b, 2.7e+187], N[(N[(2.0 * N[(N[(b + a), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(0.005555555555555556 * N[(Pi * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(0.011111111111111112 * N[(N[Power[b, 2.0], $MachinePrecision] * N[(Pi * angle$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)
\\
angle_s \cdot \begin{array}{l}
\mathbf{if}\;b \leq 2.7 \cdot 10^{+187}:\\
\;\;\;\;\left(2 \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)\right) \cdot \sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle_m\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.011111111111111112 \cdot \left({b}^{2} \cdot \left(\pi \cdot angle_m\right)\right)\\
\end{array}
\end{array}
if b < 2.70000000000000008e187Initial program 57.6%
unpow257.6%
unpow257.6%
difference-of-squares60.3%
Applied egg-rr60.3%
Taylor expanded in angle around 0 61.2%
Taylor expanded in angle around 0 60.3%
if 2.70000000000000008e187 < b Initial program 52.5%
unpow252.5%
unpow252.5%
difference-of-squares62.8%
Applied egg-rr62.8%
Taylor expanded in angle around 0 66.3%
Taylor expanded in angle around 0 76.6%
Taylor expanded in a around 0 80.0%
*-commutative80.0%
associate-*l*80.0%
*-commutative80.0%
Simplified80.0%
Final simplification62.6%
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b angle_m)
:precision binary64
(*
angle_s
(if (<= b 5e+183)
(*
(* 2.0 (* (+ b a) (- b a)))
(sin (* PI (* angle_m 0.005555555555555556))))
(* 0.011111111111111112 (* (pow b 2.0) (* PI angle_m))))))angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
double tmp;
if (b <= 5e+183) {
tmp = (2.0 * ((b + a) * (b - a))) * sin((((double) M_PI) * (angle_m * 0.005555555555555556)));
} else {
tmp = 0.011111111111111112 * (pow(b, 2.0) * (((double) M_PI) * angle_m));
}
return angle_s * tmp;
}
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
double tmp;
if (b <= 5e+183) {
tmp = (2.0 * ((b + a) * (b - a))) * Math.sin((Math.PI * (angle_m * 0.005555555555555556)));
} else {
tmp = 0.011111111111111112 * (Math.pow(b, 2.0) * (Math.PI * angle_m));
}
return angle_s * tmp;
}
angle_m = math.fabs(angle) angle_s = math.copysign(1.0, angle) def code(angle_s, a, b, angle_m): tmp = 0 if b <= 5e+183: tmp = (2.0 * ((b + a) * (b - a))) * math.sin((math.pi * (angle_m * 0.005555555555555556))) else: tmp = 0.011111111111111112 * (math.pow(b, 2.0) * (math.pi * angle_m)) return angle_s * tmp
angle_m = abs(angle) angle_s = copysign(1.0, angle) function code(angle_s, a, b, angle_m) tmp = 0.0 if (b <= 5e+183) tmp = Float64(Float64(2.0 * Float64(Float64(b + a) * Float64(b - a))) * sin(Float64(pi * Float64(angle_m * 0.005555555555555556)))); else tmp = Float64(0.011111111111111112 * Float64((b ^ 2.0) * Float64(pi * angle_m))); end return Float64(angle_s * tmp) end
angle_m = abs(angle); angle_s = sign(angle) * abs(1.0); function tmp_2 = code(angle_s, a, b, angle_m) tmp = 0.0; if (b <= 5e+183) tmp = (2.0 * ((b + a) * (b - a))) * sin((pi * (angle_m * 0.005555555555555556))); else tmp = 0.011111111111111112 * ((b ^ 2.0) * (pi * angle_m)); end tmp_2 = angle_s * tmp; end
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_, b_, angle$95$m_] := N[(angle$95$s * If[LessEqual[b, 5e+183], N[(N[(2.0 * N[(N[(b + a), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(0.011111111111111112 * N[(N[Power[b, 2.0], $MachinePrecision] * N[(Pi * angle$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)
\\
angle_s \cdot \begin{array}{l}
\mathbf{if}\;b \leq 5 \cdot 10^{+183}:\\
\;\;\;\;\left(2 \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)\right) \cdot \sin \left(\pi \cdot \left(angle_m \cdot 0.005555555555555556\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.011111111111111112 \cdot \left({b}^{2} \cdot \left(\pi \cdot angle_m\right)\right)\\
\end{array}
\end{array}
if b < 5.00000000000000009e183Initial program 57.6%
unpow257.6%
unpow257.6%
difference-of-squares60.3%
Applied egg-rr60.3%
Taylor expanded in angle around 0 60.6%
Taylor expanded in angle around inf 60.3%
associate-*r*60.7%
*-commutative60.7%
*-commutative60.7%
*-commutative60.7%
Simplified60.7%
if 5.00000000000000009e183 < b Initial program 52.5%
unpow252.5%
unpow252.5%
difference-of-squares62.8%
Applied egg-rr62.8%
Taylor expanded in angle around 0 66.3%
Taylor expanded in angle around 0 76.6%
Taylor expanded in a around 0 80.0%
*-commutative80.0%
associate-*l*80.0%
*-commutative80.0%
Simplified80.0%
Final simplification62.9%
angle_m = (fabs.f64 angle) angle_s = (copysign.f64 1 angle) (FPCore (angle_s a b angle_m) :precision binary64 (* angle_s (* 0.011111111111111112 (* angle_m (* (* (+ b a) (- b a)) PI)))))
angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
return angle_s * (0.011111111111111112 * (angle_m * (((b + a) * (b - a)) * ((double) M_PI))));
}
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
return angle_s * (0.011111111111111112 * (angle_m * (((b + a) * (b - a)) * Math.PI)));
}
angle_m = math.fabs(angle) angle_s = math.copysign(1.0, angle) def code(angle_s, a, b, angle_m): return angle_s * (0.011111111111111112 * (angle_m * (((b + a) * (b - a)) * math.pi)))
angle_m = abs(angle) angle_s = copysign(1.0, angle) function code(angle_s, a, b, angle_m) return Float64(angle_s * Float64(0.011111111111111112 * Float64(angle_m * Float64(Float64(Float64(b + a) * Float64(b - a)) * pi)))) end
angle_m = abs(angle); angle_s = sign(angle) * abs(1.0); function tmp = code(angle_s, a, b, angle_m) tmp = angle_s * (0.011111111111111112 * (angle_m * (((b + a) * (b - a)) * pi))); end
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_, b_, angle$95$m_] := N[(angle$95$s * N[(0.011111111111111112 * N[(angle$95$m * N[(N[(N[(b + a), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)
\\
angle_s \cdot \left(0.011111111111111112 \cdot \left(angle_m \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \pi\right)\right)\right)
\end{array}
Initial program 57.0%
unpow257.0%
unpow257.0%
difference-of-squares60.6%
Applied egg-rr60.6%
Taylor expanded in angle around 0 61.2%
Taylor expanded in angle around 0 60.0%
Final simplification60.0%
herbie shell --seed 2023331
(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)))))