
(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 17 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}
NOTE: b should be positive before calling this function
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* (sin (* 0.005555555555555556 (* PI angle))) (+ a b)))
(t_1 (cbrt (cos (* PI (* 0.005555555555555556 angle))))))
(if (<= (pow a 2.0) 2e+294)
(* 2.0 (* (- b a) (* (* t_1 (* t_1 t_1)) t_0)))
(*
2.0
(*
(- b a)
(*
t_0
(cos (* 0.005555555555555556 (* angle (* (sqrt PI) (sqrt PI)))))))))))b = abs(b);
double code(double a, double b, double angle) {
double t_0 = sin((0.005555555555555556 * (((double) M_PI) * angle))) * (a + b);
double t_1 = cbrt(cos((((double) M_PI) * (0.005555555555555556 * angle))));
double tmp;
if (pow(a, 2.0) <= 2e+294) {
tmp = 2.0 * ((b - a) * ((t_1 * (t_1 * t_1)) * t_0));
} else {
tmp = 2.0 * ((b - a) * (t_0 * cos((0.005555555555555556 * (angle * (sqrt(((double) M_PI)) * sqrt(((double) M_PI))))))));
}
return tmp;
}
b = Math.abs(b);
public static double code(double a, double b, double angle) {
double t_0 = Math.sin((0.005555555555555556 * (Math.PI * angle))) * (a + b);
double t_1 = Math.cbrt(Math.cos((Math.PI * (0.005555555555555556 * angle))));
double tmp;
if (Math.pow(a, 2.0) <= 2e+294) {
tmp = 2.0 * ((b - a) * ((t_1 * (t_1 * t_1)) * t_0));
} else {
tmp = 2.0 * ((b - a) * (t_0 * Math.cos((0.005555555555555556 * (angle * (Math.sqrt(Math.PI) * Math.sqrt(Math.PI)))))));
}
return tmp;
}
b = abs(b) function code(a, b, angle) t_0 = Float64(sin(Float64(0.005555555555555556 * Float64(pi * angle))) * Float64(a + b)) t_1 = cbrt(cos(Float64(pi * Float64(0.005555555555555556 * angle)))) tmp = 0.0 if ((a ^ 2.0) <= 2e+294) tmp = Float64(2.0 * Float64(Float64(b - a) * Float64(Float64(t_1 * Float64(t_1 * t_1)) * t_0))); else tmp = Float64(2.0 * Float64(Float64(b - a) * Float64(t_0 * cos(Float64(0.005555555555555556 * Float64(angle * Float64(sqrt(pi) * sqrt(pi)))))))); end return tmp end
NOTE: b should be positive before calling this function
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[Sin[N[(0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(a + b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[Cos[N[(Pi * N[(0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision]}, If[LessEqual[N[Power[a, 2.0], $MachinePrecision], 2e+294], N[(2.0 * N[(N[(b - a), $MachinePrecision] * N[(N[(t$95$1 * N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(b - a), $MachinePrecision] * N[(t$95$0 * N[Cos[N[(0.005555555555555556 * N[(angle * N[(N[Sqrt[Pi], $MachinePrecision] * N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
b = |b|\\
\\
\begin{array}{l}
t_0 := \sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right) \cdot \left(a + b\right)\\
t_1 := \sqrt[3]{\cos \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)}\\
\mathbf{if}\;{a}^{2} \leq 2 \cdot 10^{+294}:\\
\;\;\;\;2 \cdot \left(\left(b - a\right) \cdot \left(\left(t_1 \cdot \left(t_1 \cdot t_1\right)\right) \cdot t_0\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\left(b - a\right) \cdot \left(t_0 \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \left(\sqrt{\pi} \cdot \sqrt{\pi}\right)\right)\right)\right)\right)\\
\end{array}
\end{array}
if (pow.f64 a 2) < 2.00000000000000013e294Initial program 59.7%
associate-*l*59.7%
associate-*l*59.7%
unpow259.7%
unpow259.7%
difference-of-squares59.7%
Simplified59.7%
Taylor expanded in angle around inf 68.7%
*-commutative68.7%
*-commutative68.7%
associate-*r*69.1%
add-cube-cbrt66.7%
unpow367.2%
add-cube-cbrt67.2%
Applied egg-rr69.1%
if 2.00000000000000013e294 < (pow.f64 a 2) Initial program 30.2%
associate-*l*30.2%
associate-*l*30.2%
unpow230.2%
unpow230.2%
difference-of-squares51.8%
Simplified51.8%
Taylor expanded in angle around inf 76.6%
add-sqr-sqrt86.3%
Applied egg-rr86.3%
Final simplification74.5%
NOTE: b should be positive before calling this function
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* (sin (* 0.005555555555555556 (* PI angle))) (+ a b))))
(if (<= (pow a 2.0) 2e+294)
(*
2.0
(*
(- b a)
(* t_0 (log1p (expm1 (cos (* PI (* 0.005555555555555556 angle))))))))
(*
2.0
(*
(- b a)
(*
t_0
(cos (* 0.005555555555555556 (* angle (* (sqrt PI) (sqrt PI)))))))))))b = abs(b);
double code(double a, double b, double angle) {
double t_0 = sin((0.005555555555555556 * (((double) M_PI) * angle))) * (a + b);
double tmp;
if (pow(a, 2.0) <= 2e+294) {
tmp = 2.0 * ((b - a) * (t_0 * log1p(expm1(cos((((double) M_PI) * (0.005555555555555556 * angle)))))));
} else {
tmp = 2.0 * ((b - a) * (t_0 * cos((0.005555555555555556 * (angle * (sqrt(((double) M_PI)) * sqrt(((double) M_PI))))))));
}
return tmp;
}
b = Math.abs(b);
public static double code(double a, double b, double angle) {
double t_0 = Math.sin((0.005555555555555556 * (Math.PI * angle))) * (a + b);
double tmp;
if (Math.pow(a, 2.0) <= 2e+294) {
tmp = 2.0 * ((b - a) * (t_0 * Math.log1p(Math.expm1(Math.cos((Math.PI * (0.005555555555555556 * angle)))))));
} else {
tmp = 2.0 * ((b - a) * (t_0 * Math.cos((0.005555555555555556 * (angle * (Math.sqrt(Math.PI) * Math.sqrt(Math.PI)))))));
}
return tmp;
}
b = abs(b) def code(a, b, angle): t_0 = math.sin((0.005555555555555556 * (math.pi * angle))) * (a + b) tmp = 0 if math.pow(a, 2.0) <= 2e+294: tmp = 2.0 * ((b - a) * (t_0 * math.log1p(math.expm1(math.cos((math.pi * (0.005555555555555556 * angle))))))) else: tmp = 2.0 * ((b - a) * (t_0 * math.cos((0.005555555555555556 * (angle * (math.sqrt(math.pi) * math.sqrt(math.pi))))))) return tmp
b = abs(b) function code(a, b, angle) t_0 = Float64(sin(Float64(0.005555555555555556 * Float64(pi * angle))) * Float64(a + b)) tmp = 0.0 if ((a ^ 2.0) <= 2e+294) tmp = Float64(2.0 * Float64(Float64(b - a) * Float64(t_0 * log1p(expm1(cos(Float64(pi * Float64(0.005555555555555556 * angle)))))))); else tmp = Float64(2.0 * Float64(Float64(b - a) * Float64(t_0 * cos(Float64(0.005555555555555556 * Float64(angle * Float64(sqrt(pi) * sqrt(pi)))))))); end return tmp end
NOTE: b should be positive before calling this function
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[Sin[N[(0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(a + b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[a, 2.0], $MachinePrecision], 2e+294], N[(2.0 * N[(N[(b - a), $MachinePrecision] * N[(t$95$0 * N[Log[1 + N[(Exp[N[Cos[N[(Pi * N[(0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(b - a), $MachinePrecision] * N[(t$95$0 * N[Cos[N[(0.005555555555555556 * N[(angle * N[(N[Sqrt[Pi], $MachinePrecision] * N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
b = |b|\\
\\
\begin{array}{l}
t_0 := \sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right) \cdot \left(a + b\right)\\
\mathbf{if}\;{a}^{2} \leq 2 \cdot 10^{+294}:\\
\;\;\;\;2 \cdot \left(\left(b - a\right) \cdot \left(t_0 \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\left(b - a\right) \cdot \left(t_0 \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \left(\sqrt{\pi} \cdot \sqrt{\pi}\right)\right)\right)\right)\right)\\
\end{array}
\end{array}
if (pow.f64 a 2) < 2.00000000000000013e294Initial program 59.7%
associate-*l*59.7%
associate-*l*59.7%
unpow259.7%
unpow259.7%
difference-of-squares59.7%
Simplified59.7%
Taylor expanded in angle around inf 68.7%
*-commutative68.7%
*-commutative68.7%
associate-*r*69.1%
add-cube-cbrt66.7%
unpow367.2%
log1p-expm1-u67.2%
unpow366.7%
add-cube-cbrt69.1%
*-commutative69.1%
Applied egg-rr69.1%
if 2.00000000000000013e294 < (pow.f64 a 2) Initial program 30.2%
associate-*l*30.2%
associate-*l*30.2%
unpow230.2%
unpow230.2%
difference-of-squares51.8%
Simplified51.8%
Taylor expanded in angle around inf 76.6%
add-sqr-sqrt86.3%
Applied egg-rr86.3%
Final simplification74.5%
NOTE: b should be positive before calling this function
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* 0.005555555555555556 (* PI angle))))
(if (<= (- (pow b 2.0) (pow a 2.0)) (- INFINITY))
(* (* (* (- b a) angle) (* PI (+ a b))) 0.011111111111111112)
(* 2.0 (* (- b a) (* (* (sin t_0) (+ a b)) (cos t_0)))))))b = abs(b);
double code(double a, double b, double angle) {
double t_0 = 0.005555555555555556 * (((double) M_PI) * angle);
double tmp;
if ((pow(b, 2.0) - pow(a, 2.0)) <= -((double) INFINITY)) {
tmp = (((b - a) * angle) * (((double) M_PI) * (a + b))) * 0.011111111111111112;
} else {
tmp = 2.0 * ((b - a) * ((sin(t_0) * (a + b)) * cos(t_0)));
}
return tmp;
}
b = Math.abs(b);
public static double code(double a, double b, double angle) {
double t_0 = 0.005555555555555556 * (Math.PI * angle);
double tmp;
if ((Math.pow(b, 2.0) - Math.pow(a, 2.0)) <= -Double.POSITIVE_INFINITY) {
tmp = (((b - a) * angle) * (Math.PI * (a + b))) * 0.011111111111111112;
} else {
tmp = 2.0 * ((b - a) * ((Math.sin(t_0) * (a + b)) * Math.cos(t_0)));
}
return tmp;
}
b = abs(b) def code(a, b, angle): t_0 = 0.005555555555555556 * (math.pi * angle) tmp = 0 if (math.pow(b, 2.0) - math.pow(a, 2.0)) <= -math.inf: tmp = (((b - a) * angle) * (math.pi * (a + b))) * 0.011111111111111112 else: tmp = 2.0 * ((b - a) * ((math.sin(t_0) * (a + b)) * math.cos(t_0))) return tmp
b = abs(b) function code(a, b, angle) t_0 = Float64(0.005555555555555556 * Float64(pi * angle)) tmp = 0.0 if (Float64((b ^ 2.0) - (a ^ 2.0)) <= Float64(-Inf)) tmp = Float64(Float64(Float64(Float64(b - a) * angle) * Float64(pi * Float64(a + b))) * 0.011111111111111112); else tmp = Float64(2.0 * Float64(Float64(b - a) * Float64(Float64(sin(t_0) * Float64(a + b)) * cos(t_0)))); end return tmp end
b = abs(b) function tmp_2 = code(a, b, angle) t_0 = 0.005555555555555556 * (pi * angle); tmp = 0.0; if (((b ^ 2.0) - (a ^ 2.0)) <= -Inf) tmp = (((b - a) * angle) * (pi * (a + b))) * 0.011111111111111112; else tmp = 2.0 * ((b - a) * ((sin(t_0) * (a + b)) * cos(t_0))); end tmp_2 = tmp; end
NOTE: b should be positive before calling this function
code[a_, b_, angle_] := Block[{t$95$0 = N[(0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision], (-Infinity)], N[(N[(N[(N[(b - a), $MachinePrecision] * angle), $MachinePrecision] * N[(Pi * N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.011111111111111112), $MachinePrecision], N[(2.0 * N[(N[(b - a), $MachinePrecision] * N[(N[(N[Sin[t$95$0], $MachinePrecision] * N[(a + b), $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
b = |b|\\
\\
\begin{array}{l}
t_0 := 0.005555555555555556 \cdot \left(\pi \cdot angle\right)\\
\mathbf{if}\;{b}^{2} - {a}^{2} \leq -\infty:\\
\;\;\;\;\left(\left(\left(b - a\right) \cdot angle\right) \cdot \left(\pi \cdot \left(a + b\right)\right)\right) \cdot 0.011111111111111112\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\left(b - a\right) \cdot \left(\left(\sin t_0 \cdot \left(a + b\right)\right) \cdot \cos t_0\right)\right)\\
\end{array}
\end{array}
if (-.f64 (pow.f64 b 2) (pow.f64 a 2)) < -inf.0Initial program 45.1%
associate-*l*45.1%
unpow245.1%
unpow245.1%
difference-of-squares45.1%
Simplified45.1%
Taylor expanded in angle around 0 54.9%
*-commutative54.9%
associate-*r*80.3%
Simplified80.3%
if -inf.0 < (-.f64 (pow.f64 b 2) (pow.f64 a 2)) Initial program 51.7%
associate-*l*51.7%
associate-*l*51.7%
unpow251.7%
unpow251.7%
difference-of-squares60.2%
Simplified60.2%
Taylor expanded in angle around inf 71.4%
Final simplification73.2%
NOTE: b should be positive before calling this function
(FPCore (a b angle)
:precision binary64
(*
2.0
(*
(- b a)
(*
(* (sin (* 0.005555555555555556 (* PI angle))) (+ a b))
(log1p (expm1 (cos (* PI (* 0.005555555555555556 angle)))))))))b = abs(b);
double code(double a, double b, double angle) {
return 2.0 * ((b - a) * ((sin((0.005555555555555556 * (((double) M_PI) * angle))) * (a + b)) * log1p(expm1(cos((((double) M_PI) * (0.005555555555555556 * angle)))))));
}
b = Math.abs(b);
public static double code(double a, double b, double angle) {
return 2.0 * ((b - a) * ((Math.sin((0.005555555555555556 * (Math.PI * angle))) * (a + b)) * Math.log1p(Math.expm1(Math.cos((Math.PI * (0.005555555555555556 * angle)))))));
}
b = abs(b) def code(a, b, angle): return 2.0 * ((b - a) * ((math.sin((0.005555555555555556 * (math.pi * angle))) * (a + b)) * math.log1p(math.expm1(math.cos((math.pi * (0.005555555555555556 * angle)))))))
b = abs(b) function code(a, b, angle) return Float64(2.0 * Float64(Float64(b - a) * Float64(Float64(sin(Float64(0.005555555555555556 * Float64(pi * angle))) * Float64(a + b)) * log1p(expm1(cos(Float64(pi * Float64(0.005555555555555556 * angle)))))))) end
NOTE: b should be positive before calling this function code[a_, b_, angle_] := N[(2.0 * N[(N[(b - a), $MachinePrecision] * N[(N[(N[Sin[N[(0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(a + b), $MachinePrecision]), $MachinePrecision] * N[Log[1 + N[(Exp[N[Cos[N[(Pi * N[(0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b = |b|\\
\\
2 \cdot \left(\left(b - a\right) \cdot \left(\left(\sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right) \cdot \left(a + b\right)\right) \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)\right)\right)\right)
\end{array}
Initial program 50.4%
associate-*l*50.4%
associate-*l*50.4%
unpow250.4%
unpow250.4%
difference-of-squares57.2%
Simplified57.2%
Taylor expanded in angle around inf 71.2%
*-commutative71.2%
*-commutative71.2%
associate-*r*71.8%
add-cube-cbrt69.4%
unpow370.9%
log1p-expm1-u70.9%
unpow369.4%
add-cube-cbrt71.8%
*-commutative71.8%
Applied egg-rr71.8%
Final simplification71.8%
NOTE: b should be positive before calling this function
(FPCore (a b angle)
:precision binary64
(if (or (<= (/ angle 180.0) -5e+116) (not (<= (/ angle 180.0) 2e+55)))
(*
(* (sin (* 2.0 (* PI (* 0.005555555555555556 angle)))) 0.5)
(* 2.0 (pow (+ a b) 2.0)))
(*
2.0
(* (- b a) (* (sin (* 0.005555555555555556 (* PI angle))) (+ a b))))))b = abs(b);
double code(double a, double b, double angle) {
double tmp;
if (((angle / 180.0) <= -5e+116) || !((angle / 180.0) <= 2e+55)) {
tmp = (sin((2.0 * (((double) M_PI) * (0.005555555555555556 * angle)))) * 0.5) * (2.0 * pow((a + b), 2.0));
} else {
tmp = 2.0 * ((b - a) * (sin((0.005555555555555556 * (((double) M_PI) * angle))) * (a + b)));
}
return tmp;
}
b = Math.abs(b);
public static double code(double a, double b, double angle) {
double tmp;
if (((angle / 180.0) <= -5e+116) || !((angle / 180.0) <= 2e+55)) {
tmp = (Math.sin((2.0 * (Math.PI * (0.005555555555555556 * angle)))) * 0.5) * (2.0 * Math.pow((a + b), 2.0));
} else {
tmp = 2.0 * ((b - a) * (Math.sin((0.005555555555555556 * (Math.PI * angle))) * (a + b)));
}
return tmp;
}
b = abs(b) def code(a, b, angle): tmp = 0 if ((angle / 180.0) <= -5e+116) or not ((angle / 180.0) <= 2e+55): tmp = (math.sin((2.0 * (math.pi * (0.005555555555555556 * angle)))) * 0.5) * (2.0 * math.pow((a + b), 2.0)) else: tmp = 2.0 * ((b - a) * (math.sin((0.005555555555555556 * (math.pi * angle))) * (a + b))) return tmp
b = abs(b) function code(a, b, angle) tmp = 0.0 if ((Float64(angle / 180.0) <= -5e+116) || !(Float64(angle / 180.0) <= 2e+55)) tmp = Float64(Float64(sin(Float64(2.0 * Float64(pi * Float64(0.005555555555555556 * angle)))) * 0.5) * Float64(2.0 * (Float64(a + b) ^ 2.0))); else tmp = Float64(2.0 * Float64(Float64(b - a) * Float64(sin(Float64(0.005555555555555556 * Float64(pi * angle))) * Float64(a + b)))); end return tmp end
b = abs(b) function tmp_2 = code(a, b, angle) tmp = 0.0; if (((angle / 180.0) <= -5e+116) || ~(((angle / 180.0) <= 2e+55))) tmp = (sin((2.0 * (pi * (0.005555555555555556 * angle)))) * 0.5) * (2.0 * ((a + b) ^ 2.0)); else tmp = 2.0 * ((b - a) * (sin((0.005555555555555556 * (pi * angle))) * (a + b))); end tmp_2 = tmp; end
NOTE: b should be positive before calling this function code[a_, b_, angle_] := If[Or[LessEqual[N[(angle / 180.0), $MachinePrecision], -5e+116], N[Not[LessEqual[N[(angle / 180.0), $MachinePrecision], 2e+55]], $MachinePrecision]], N[(N[(N[Sin[N[(2.0 * N[(Pi * N[(0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision] * N[(2.0 * N[Power[N[(a + b), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(b - a), $MachinePrecision] * N[(N[Sin[N[(0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
b = |b|\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{angle}{180} \leq -5 \cdot 10^{+116} \lor \neg \left(\frac{angle}{180} \leq 2 \cdot 10^{+55}\right):\\
\;\;\;\;\left(\sin \left(2 \cdot \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right) \cdot 0.5\right) \cdot \left(2 \cdot {\left(a + b\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\left(b - a\right) \cdot \left(\sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right) \cdot \left(a + b\right)\right)\right)\\
\end{array}
\end{array}
if (/.f64 angle 180) < -5.00000000000000025e116 or 2.00000000000000002e55 < (/.f64 angle 180) Initial program 26.7%
*-commutative26.7%
associate-*l*26.7%
unpow226.7%
fma-neg27.8%
unpow227.8%
Simplified27.8%
Applied egg-rr23.6%
expm1-def24.5%
expm1-log1p42.6%
sin-042.6%
+-lft-identity42.6%
*-commutative42.6%
+-commutative42.6%
Simplified42.6%
if -5.00000000000000025e116 < (/.f64 angle 180) < 2.00000000000000002e55Initial program 63.2%
associate-*l*63.2%
unpow263.2%
unpow263.2%
difference-of-squares72.0%
Simplified72.0%
add-cube-cbrt70.2%
pow370.7%
div-inv71.3%
metadata-eval71.3%
Applied egg-rr71.3%
Taylor expanded in angle around inf 89.6%
*-commutative89.6%
+-commutative89.6%
Simplified89.6%
Final simplification73.1%
NOTE: b should be positive before calling this function (FPCore (a b angle) :precision binary64 (* 2.0 (* (+ a b) (* (- b a) (sin (* PI (* 0.005555555555555556 angle)))))))
b = abs(b);
double code(double a, double b, double angle) {
return 2.0 * ((a + b) * ((b - a) * sin((((double) M_PI) * (0.005555555555555556 * angle)))));
}
b = Math.abs(b);
public static double code(double a, double b, double angle) {
return 2.0 * ((a + b) * ((b - a) * Math.sin((Math.PI * (0.005555555555555556 * angle)))));
}
b = abs(b) def code(a, b, angle): return 2.0 * ((a + b) * ((b - a) * math.sin((math.pi * (0.005555555555555556 * angle)))))
b = abs(b) function code(a, b, angle) return Float64(2.0 * Float64(Float64(a + b) * Float64(Float64(b - a) * sin(Float64(pi * Float64(0.005555555555555556 * angle)))))) end
b = abs(b) function tmp = code(a, b, angle) tmp = 2.0 * ((a + b) * ((b - a) * sin((pi * (0.005555555555555556 * angle))))); end
NOTE: b should be positive before calling this function code[a_, b_, angle_] := N[(2.0 * N[(N[(a + b), $MachinePrecision] * N[(N[(b - a), $MachinePrecision] * N[Sin[N[(Pi * N[(0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b = |b|\\
\\
2 \cdot \left(\left(a + b\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)\right)
\end{array}
Initial program 50.4%
associate-*l*50.4%
unpow250.4%
unpow250.4%
difference-of-squares57.2%
Simplified57.2%
add-cube-cbrt57.4%
pow358.0%
div-inv58.9%
metadata-eval58.9%
Applied egg-rr58.9%
Taylor expanded in angle around inf 67.5%
associate-*r*67.5%
associate-*r*68.2%
*-commutative68.2%
+-commutative68.2%
Simplified68.2%
Final simplification68.2%
NOTE: b should be positive before calling this function (FPCore (a b angle) :precision binary64 (if (<= a 2.15e-166) (* (sin (* PI (/ angle 180.0))) (* 2.0 (* b b))) (* (* (* (- b a) angle) (* PI (+ a b))) 0.011111111111111112)))
b = abs(b);
double code(double a, double b, double angle) {
double tmp;
if (a <= 2.15e-166) {
tmp = sin((((double) M_PI) * (angle / 180.0))) * (2.0 * (b * b));
} else {
tmp = (((b - a) * angle) * (((double) M_PI) * (a + b))) * 0.011111111111111112;
}
return tmp;
}
b = Math.abs(b);
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 2.15e-166) {
tmp = Math.sin((Math.PI * (angle / 180.0))) * (2.0 * (b * b));
} else {
tmp = (((b - a) * angle) * (Math.PI * (a + b))) * 0.011111111111111112;
}
return tmp;
}
b = abs(b) def code(a, b, angle): tmp = 0 if a <= 2.15e-166: tmp = math.sin((math.pi * (angle / 180.0))) * (2.0 * (b * b)) else: tmp = (((b - a) * angle) * (math.pi * (a + b))) * 0.011111111111111112 return tmp
b = abs(b) function code(a, b, angle) tmp = 0.0 if (a <= 2.15e-166) tmp = Float64(sin(Float64(pi * Float64(angle / 180.0))) * Float64(2.0 * Float64(b * b))); else tmp = Float64(Float64(Float64(Float64(b - a) * angle) * Float64(pi * Float64(a + b))) * 0.011111111111111112); end return tmp end
b = abs(b) function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 2.15e-166) tmp = sin((pi * (angle / 180.0))) * (2.0 * (b * b)); else tmp = (((b - a) * angle) * (pi * (a + b))) * 0.011111111111111112; end tmp_2 = tmp; end
NOTE: b should be positive before calling this function code[a_, b_, angle_] := If[LessEqual[a, 2.15e-166], N[(N[Sin[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(2.0 * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(b - a), $MachinePrecision] * angle), $MachinePrecision] * N[(Pi * N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]]
\begin{array}{l}
b = |b|\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq 2.15 \cdot 10^{-166}:\\
\;\;\;\;\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \left(2 \cdot \left(b \cdot b\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(b - a\right) \cdot angle\right) \cdot \left(\pi \cdot \left(a + b\right)\right)\right) \cdot 0.011111111111111112\\
\end{array}
\end{array}
if a < 2.15e-166Initial program 54.7%
*-commutative54.7%
associate-*l*54.7%
unpow254.7%
fma-neg56.7%
unpow256.7%
Simplified56.7%
Taylor expanded in b around inf 42.4%
unpow242.4%
Simplified42.4%
Taylor expanded in angle around 0 40.1%
if 2.15e-166 < a Initial program 44.2%
associate-*l*44.2%
unpow244.2%
unpow244.2%
difference-of-squares53.1%
Simplified53.1%
Taylor expanded in angle around 0 53.0%
*-commutative53.0%
associate-*r*65.4%
Simplified65.4%
Final simplification50.5%
NOTE: b should be positive before calling this function
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* 0.011111111111111112 (* angle (* PI (* b b))))))
(if (<= a 1.16e-27)
t_0
(if (<= a 9.5e-11)
(* PI (* (* a a) (* angle -0.011111111111111112)))
(if (<= a 4.5e+28)
t_0
(* angle (* PI (* (* a a) -0.011111111111111112))))))))b = abs(b);
double code(double a, double b, double angle) {
double t_0 = 0.011111111111111112 * (angle * (((double) M_PI) * (b * b)));
double tmp;
if (a <= 1.16e-27) {
tmp = t_0;
} else if (a <= 9.5e-11) {
tmp = ((double) M_PI) * ((a * a) * (angle * -0.011111111111111112));
} else if (a <= 4.5e+28) {
tmp = t_0;
} else {
tmp = angle * (((double) M_PI) * ((a * a) * -0.011111111111111112));
}
return tmp;
}
b = Math.abs(b);
public static double code(double a, double b, double angle) {
double t_0 = 0.011111111111111112 * (angle * (Math.PI * (b * b)));
double tmp;
if (a <= 1.16e-27) {
tmp = t_0;
} else if (a <= 9.5e-11) {
tmp = Math.PI * ((a * a) * (angle * -0.011111111111111112));
} else if (a <= 4.5e+28) {
tmp = t_0;
} else {
tmp = angle * (Math.PI * ((a * a) * -0.011111111111111112));
}
return tmp;
}
b = abs(b) def code(a, b, angle): t_0 = 0.011111111111111112 * (angle * (math.pi * (b * b))) tmp = 0 if a <= 1.16e-27: tmp = t_0 elif a <= 9.5e-11: tmp = math.pi * ((a * a) * (angle * -0.011111111111111112)) elif a <= 4.5e+28: tmp = t_0 else: tmp = angle * (math.pi * ((a * a) * -0.011111111111111112)) return tmp
b = abs(b) function code(a, b, angle) t_0 = Float64(0.011111111111111112 * Float64(angle * Float64(pi * Float64(b * b)))) tmp = 0.0 if (a <= 1.16e-27) tmp = t_0; elseif (a <= 9.5e-11) tmp = Float64(pi * Float64(Float64(a * a) * Float64(angle * -0.011111111111111112))); elseif (a <= 4.5e+28) tmp = t_0; else tmp = Float64(angle * Float64(pi * Float64(Float64(a * a) * -0.011111111111111112))); end return tmp end
b = abs(b) function tmp_2 = code(a, b, angle) t_0 = 0.011111111111111112 * (angle * (pi * (b * b))); tmp = 0.0; if (a <= 1.16e-27) tmp = t_0; elseif (a <= 9.5e-11) tmp = pi * ((a * a) * (angle * -0.011111111111111112)); elseif (a <= 4.5e+28) tmp = t_0; else tmp = angle * (pi * ((a * a) * -0.011111111111111112)); end tmp_2 = tmp; end
NOTE: b should be positive before calling this function
code[a_, b_, angle_] := Block[{t$95$0 = N[(0.011111111111111112 * N[(angle * N[(Pi * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, 1.16e-27], t$95$0, If[LessEqual[a, 9.5e-11], N[(Pi * N[(N[(a * a), $MachinePrecision] * N[(angle * -0.011111111111111112), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 4.5e+28], t$95$0, N[(angle * N[(Pi * N[(N[(a * a), $MachinePrecision] * -0.011111111111111112), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
b = |b|\\
\\
\begin{array}{l}
t_0 := 0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \left(b \cdot b\right)\right)\right)\\
\mathbf{if}\;a \leq 1.16 \cdot 10^{-27}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;a \leq 9.5 \cdot 10^{-11}:\\
\;\;\;\;\pi \cdot \left(\left(a \cdot a\right) \cdot \left(angle \cdot -0.011111111111111112\right)\right)\\
\mathbf{elif}\;a \leq 4.5 \cdot 10^{+28}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;angle \cdot \left(\pi \cdot \left(\left(a \cdot a\right) \cdot -0.011111111111111112\right)\right)\\
\end{array}
\end{array}
if a < 1.16000000000000005e-27 or 9.49999999999999951e-11 < a < 4.4999999999999997e28Initial program 55.9%
associate-*l*55.9%
unpow255.9%
unpow255.9%
difference-of-squares60.3%
Simplified60.3%
Taylor expanded in angle around 0 56.4%
Taylor expanded in b around inf 39.6%
*-commutative39.6%
*-commutative39.6%
unpow239.6%
Simplified39.6%
if 1.16000000000000005e-27 < a < 9.49999999999999951e-11Initial program 67.1%
associate-*l*67.1%
unpow267.1%
unpow267.1%
difference-of-squares67.1%
Simplified67.1%
Taylor expanded in angle around 0 47.4%
Taylor expanded in b around 0 47.4%
*-commutative47.4%
*-commutative47.4%
unpow247.4%
Simplified47.4%
Taylor expanded in angle around 0 47.4%
*-commutative47.4%
*-commutative47.4%
associate-*r*47.7%
associate-*l*48.0%
associate-*r*48.0%
unpow248.0%
Simplified48.0%
Taylor expanded in angle around 0 47.4%
associate-*r*48.0%
associate-*r*48.0%
*-commutative48.0%
*-commutative48.0%
unpow248.0%
*-commutative48.0%
Simplified48.0%
if 4.4999999999999997e28 < a Initial program 32.6%
associate-*l*32.6%
unpow232.6%
unpow232.6%
difference-of-squares47.4%
Simplified47.4%
Taylor expanded in angle around 0 49.0%
Taylor expanded in b around 0 45.4%
*-commutative45.4%
*-commutative45.4%
unpow245.4%
Simplified45.4%
Taylor expanded in angle around 0 45.4%
*-commutative45.4%
*-commutative45.4%
associate-*r*45.4%
associate-*l*45.4%
associate-*r*45.4%
unpow245.4%
Simplified45.4%
Final simplification41.2%
NOTE: b should be positive before calling this function
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* PI (* b b))))
(if (<= a 7.2e-27)
(* 0.011111111111111112 (* angle t_0))
(if (<= a 9.5e-11)
(* PI (* (* a a) (* angle -0.011111111111111112)))
(if (<= a 5.2e+28)
(* (* angle 0.011111111111111112) t_0)
(* angle (* PI (* (* a a) -0.011111111111111112))))))))b = abs(b);
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (b * b);
double tmp;
if (a <= 7.2e-27) {
tmp = 0.011111111111111112 * (angle * t_0);
} else if (a <= 9.5e-11) {
tmp = ((double) M_PI) * ((a * a) * (angle * -0.011111111111111112));
} else if (a <= 5.2e+28) {
tmp = (angle * 0.011111111111111112) * t_0;
} else {
tmp = angle * (((double) M_PI) * ((a * a) * -0.011111111111111112));
}
return tmp;
}
b = Math.abs(b);
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (b * b);
double tmp;
if (a <= 7.2e-27) {
tmp = 0.011111111111111112 * (angle * t_0);
} else if (a <= 9.5e-11) {
tmp = Math.PI * ((a * a) * (angle * -0.011111111111111112));
} else if (a <= 5.2e+28) {
tmp = (angle * 0.011111111111111112) * t_0;
} else {
tmp = angle * (Math.PI * ((a * a) * -0.011111111111111112));
}
return tmp;
}
b = abs(b) def code(a, b, angle): t_0 = math.pi * (b * b) tmp = 0 if a <= 7.2e-27: tmp = 0.011111111111111112 * (angle * t_0) elif a <= 9.5e-11: tmp = math.pi * ((a * a) * (angle * -0.011111111111111112)) elif a <= 5.2e+28: tmp = (angle * 0.011111111111111112) * t_0 else: tmp = angle * (math.pi * ((a * a) * -0.011111111111111112)) return tmp
b = abs(b) function code(a, b, angle) t_0 = Float64(pi * Float64(b * b)) tmp = 0.0 if (a <= 7.2e-27) tmp = Float64(0.011111111111111112 * Float64(angle * t_0)); elseif (a <= 9.5e-11) tmp = Float64(pi * Float64(Float64(a * a) * Float64(angle * -0.011111111111111112))); elseif (a <= 5.2e+28) tmp = Float64(Float64(angle * 0.011111111111111112) * t_0); else tmp = Float64(angle * Float64(pi * Float64(Float64(a * a) * -0.011111111111111112))); end return tmp end
b = abs(b) function tmp_2 = code(a, b, angle) t_0 = pi * (b * b); tmp = 0.0; if (a <= 7.2e-27) tmp = 0.011111111111111112 * (angle * t_0); elseif (a <= 9.5e-11) tmp = pi * ((a * a) * (angle * -0.011111111111111112)); elseif (a <= 5.2e+28) tmp = (angle * 0.011111111111111112) * t_0; else tmp = angle * (pi * ((a * a) * -0.011111111111111112)); end tmp_2 = tmp; end
NOTE: b should be positive before calling this function
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, 7.2e-27], N[(0.011111111111111112 * N[(angle * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 9.5e-11], N[(Pi * N[(N[(a * a), $MachinePrecision] * N[(angle * -0.011111111111111112), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 5.2e+28], N[(N[(angle * 0.011111111111111112), $MachinePrecision] * t$95$0), $MachinePrecision], N[(angle * N[(Pi * N[(N[(a * a), $MachinePrecision] * -0.011111111111111112), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
b = |b|\\
\\
\begin{array}{l}
t_0 := \pi \cdot \left(b \cdot b\right)\\
\mathbf{if}\;a \leq 7.2 \cdot 10^{-27}:\\
\;\;\;\;0.011111111111111112 \cdot \left(angle \cdot t_0\right)\\
\mathbf{elif}\;a \leq 9.5 \cdot 10^{-11}:\\
\;\;\;\;\pi \cdot \left(\left(a \cdot a\right) \cdot \left(angle \cdot -0.011111111111111112\right)\right)\\
\mathbf{elif}\;a \leq 5.2 \cdot 10^{+28}:\\
\;\;\;\;\left(angle \cdot 0.011111111111111112\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;angle \cdot \left(\pi \cdot \left(\left(a \cdot a\right) \cdot -0.011111111111111112\right)\right)\\
\end{array}
\end{array}
if a < 7.1999999999999997e-27Initial program 56.3%
associate-*l*56.3%
unpow256.3%
unpow256.3%
difference-of-squares60.9%
Simplified60.9%
Taylor expanded in angle around 0 56.7%
Taylor expanded in b around inf 40.0%
*-commutative40.0%
*-commutative40.0%
unpow240.0%
Simplified40.0%
if 7.1999999999999997e-27 < a < 9.49999999999999951e-11Initial program 67.1%
associate-*l*67.1%
unpow267.1%
unpow267.1%
difference-of-squares67.1%
Simplified67.1%
Taylor expanded in angle around 0 47.4%
Taylor expanded in b around 0 47.4%
*-commutative47.4%
*-commutative47.4%
unpow247.4%
Simplified47.4%
Taylor expanded in angle around 0 47.4%
*-commutative47.4%
*-commutative47.4%
associate-*r*47.7%
associate-*l*48.0%
associate-*r*48.0%
unpow248.0%
Simplified48.0%
Taylor expanded in angle around 0 47.4%
associate-*r*48.0%
associate-*r*48.0%
*-commutative48.0%
*-commutative48.0%
unpow248.0%
*-commutative48.0%
Simplified48.0%
if 9.49999999999999951e-11 < a < 5.2000000000000004e28Initial program 48.9%
associate-*l*48.9%
unpow248.9%
unpow248.9%
difference-of-squares48.9%
Simplified48.9%
Taylor expanded in angle around 0 51.8%
Taylor expanded in b around inf 32.9%
associate-*r*32.9%
*-commutative32.9%
*-commutative32.9%
unpow232.9%
*-commutative32.9%
Simplified32.9%
if 5.2000000000000004e28 < a Initial program 32.6%
associate-*l*32.6%
unpow232.6%
unpow232.6%
difference-of-squares47.4%
Simplified47.4%
Taylor expanded in angle around 0 49.0%
Taylor expanded in b around 0 45.4%
*-commutative45.4%
*-commutative45.4%
unpow245.4%
Simplified45.4%
Taylor expanded in angle around 0 45.4%
*-commutative45.4%
*-commutative45.4%
associate-*r*45.4%
associate-*l*45.4%
associate-*r*45.4%
unpow245.4%
Simplified45.4%
Final simplification41.2%
NOTE: b should be positive before calling this function (FPCore (a b angle) :precision binary64 (if (<= a 9e-34) (* 0.011111111111111112 (* angle (* PI (* b b)))) (* 0.011111111111111112 (* angle (* (- b a) (* a PI))))))
b = abs(b);
double code(double a, double b, double angle) {
double tmp;
if (a <= 9e-34) {
tmp = 0.011111111111111112 * (angle * (((double) M_PI) * (b * b)));
} else {
tmp = 0.011111111111111112 * (angle * ((b - a) * (a * ((double) M_PI))));
}
return tmp;
}
b = Math.abs(b);
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 9e-34) {
tmp = 0.011111111111111112 * (angle * (Math.PI * (b * b)));
} else {
tmp = 0.011111111111111112 * (angle * ((b - a) * (a * Math.PI)));
}
return tmp;
}
b = abs(b) def code(a, b, angle): tmp = 0 if a <= 9e-34: tmp = 0.011111111111111112 * (angle * (math.pi * (b * b))) else: tmp = 0.011111111111111112 * (angle * ((b - a) * (a * math.pi))) return tmp
b = abs(b) function code(a, b, angle) tmp = 0.0 if (a <= 9e-34) tmp = Float64(0.011111111111111112 * Float64(angle * Float64(pi * Float64(b * b)))); else tmp = Float64(0.011111111111111112 * Float64(angle * Float64(Float64(b - a) * Float64(a * pi)))); end return tmp end
b = abs(b) function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 9e-34) tmp = 0.011111111111111112 * (angle * (pi * (b * b))); else tmp = 0.011111111111111112 * (angle * ((b - a) * (a * pi))); end tmp_2 = tmp; end
NOTE: b should be positive before calling this function code[a_, b_, angle_] := If[LessEqual[a, 9e-34], N[(0.011111111111111112 * N[(angle * N[(Pi * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.011111111111111112 * N[(angle * N[(N[(b - a), $MachinePrecision] * N[(a * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
b = |b|\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq 9 \cdot 10^{-34}:\\
\;\;\;\;0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \left(b \cdot b\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.011111111111111112 \cdot \left(angle \cdot \left(\left(b - a\right) \cdot \left(a \cdot \pi\right)\right)\right)\\
\end{array}
\end{array}
if a < 9.00000000000000085e-34Initial program 55.3%
associate-*l*55.3%
unpow255.3%
unpow255.3%
difference-of-squares60.0%
Simplified60.0%
Taylor expanded in angle around 0 55.7%
Taylor expanded in b around inf 39.7%
*-commutative39.7%
*-commutative39.7%
unpow239.7%
Simplified39.7%
if 9.00000000000000085e-34 < a Initial program 40.0%
associate-*l*40.0%
unpow240.0%
unpow240.0%
difference-of-squares51.3%
Simplified51.3%
Taylor expanded in angle around 0 51.7%
Taylor expanded in a around inf 46.7%
*-commutative46.7%
Simplified46.7%
Final simplification42.0%
NOTE: b should be positive before calling this function (FPCore (a b angle) :precision binary64 (if (<= b 5e-52) (* (* PI (* a a)) (* angle -0.011111111111111112)) (* 0.011111111111111112 (* angle (* (- b a) (* b PI))))))
b = abs(b);
double code(double a, double b, double angle) {
double tmp;
if (b <= 5e-52) {
tmp = (((double) M_PI) * (a * a)) * (angle * -0.011111111111111112);
} else {
tmp = 0.011111111111111112 * (angle * ((b - a) * (b * ((double) M_PI))));
}
return tmp;
}
b = Math.abs(b);
public static double code(double a, double b, double angle) {
double tmp;
if (b <= 5e-52) {
tmp = (Math.PI * (a * a)) * (angle * -0.011111111111111112);
} else {
tmp = 0.011111111111111112 * (angle * ((b - a) * (b * Math.PI)));
}
return tmp;
}
b = abs(b) def code(a, b, angle): tmp = 0 if b <= 5e-52: tmp = (math.pi * (a * a)) * (angle * -0.011111111111111112) else: tmp = 0.011111111111111112 * (angle * ((b - a) * (b * math.pi))) return tmp
b = abs(b) function code(a, b, angle) tmp = 0.0 if (b <= 5e-52) tmp = Float64(Float64(pi * Float64(a * a)) * Float64(angle * -0.011111111111111112)); else tmp = Float64(0.011111111111111112 * Float64(angle * Float64(Float64(b - a) * Float64(b * pi)))); end return tmp end
b = abs(b) function tmp_2 = code(a, b, angle) tmp = 0.0; if (b <= 5e-52) tmp = (pi * (a * a)) * (angle * -0.011111111111111112); else tmp = 0.011111111111111112 * (angle * ((b - a) * (b * pi))); end tmp_2 = tmp; end
NOTE: b should be positive before calling this function code[a_, b_, angle_] := If[LessEqual[b, 5e-52], N[(N[(Pi * N[(a * a), $MachinePrecision]), $MachinePrecision] * N[(angle * -0.011111111111111112), $MachinePrecision]), $MachinePrecision], N[(0.011111111111111112 * N[(angle * N[(N[(b - a), $MachinePrecision] * N[(b * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
b = |b|\\
\\
\begin{array}{l}
\mathbf{if}\;b \leq 5 \cdot 10^{-52}:\\
\;\;\;\;\left(\pi \cdot \left(a \cdot a\right)\right) \cdot \left(angle \cdot -0.011111111111111112\right)\\
\mathbf{else}:\\
\;\;\;\;0.011111111111111112 \cdot \left(angle \cdot \left(\left(b - a\right) \cdot \left(b \cdot \pi\right)\right)\right)\\
\end{array}
\end{array}
if b < 5e-52Initial program 53.6%
associate-*l*53.6%
unpow253.6%
unpow253.6%
difference-of-squares58.2%
Simplified58.2%
Taylor expanded in angle around 0 56.0%
Taylor expanded in b around 0 42.1%
associate-*r*42.1%
*-commutative42.1%
*-commutative42.1%
unpow242.1%
*-commutative42.1%
Simplified42.1%
if 5e-52 < b Initial program 42.4%
associate-*l*42.4%
unpow242.4%
unpow242.4%
difference-of-squares55.0%
Simplified55.0%
Taylor expanded in angle around 0 50.5%
Taylor expanded in a around 0 44.8%
*-commutative44.8%
Simplified44.8%
Final simplification42.9%
NOTE: b should be positive before calling this function (FPCore (a b angle) :precision binary64 (* 0.011111111111111112 (* angle (* (- b a) (* PI (+ a b))))))
b = abs(b);
double code(double a, double b, double angle) {
return 0.011111111111111112 * (angle * ((b - a) * (((double) M_PI) * (a + b))));
}
b = Math.abs(b);
public static double code(double a, double b, double angle) {
return 0.011111111111111112 * (angle * ((b - a) * (Math.PI * (a + b))));
}
b = abs(b) def code(a, b, angle): return 0.011111111111111112 * (angle * ((b - a) * (math.pi * (a + b))))
b = abs(b) function code(a, b, angle) return Float64(0.011111111111111112 * Float64(angle * Float64(Float64(b - a) * Float64(pi * Float64(a + b))))) end
b = abs(b) function tmp = code(a, b, angle) tmp = 0.011111111111111112 * (angle * ((b - a) * (pi * (a + b)))); end
NOTE: b should be positive before calling this function code[a_, b_, angle_] := N[(0.011111111111111112 * N[(angle * N[(N[(b - a), $MachinePrecision] * N[(Pi * N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b = |b|\\
\\
0.011111111111111112 \cdot \left(angle \cdot \left(\left(b - a\right) \cdot \left(\pi \cdot \left(a + b\right)\right)\right)\right)
\end{array}
Initial program 50.4%
associate-*l*50.4%
unpow250.4%
unpow250.4%
difference-of-squares57.2%
Simplified57.2%
Taylor expanded in angle around 0 54.4%
Final simplification54.4%
NOTE: b should be positive before calling this function (FPCore (a b angle) :precision binary64 (* angle (* 0.011111111111111112 (* (- b a) (* PI (+ a b))))))
b = abs(b);
double code(double a, double b, double angle) {
return angle * (0.011111111111111112 * ((b - a) * (((double) M_PI) * (a + b))));
}
b = Math.abs(b);
public static double code(double a, double b, double angle) {
return angle * (0.011111111111111112 * ((b - a) * (Math.PI * (a + b))));
}
b = abs(b) def code(a, b, angle): return angle * (0.011111111111111112 * ((b - a) * (math.pi * (a + b))))
b = abs(b) function code(a, b, angle) return Float64(angle * Float64(0.011111111111111112 * Float64(Float64(b - a) * Float64(pi * Float64(a + b))))) end
b = abs(b) function tmp = code(a, b, angle) tmp = angle * (0.011111111111111112 * ((b - a) * (pi * (a + b)))); end
NOTE: b should be positive before calling this function code[a_, b_, angle_] := N[(angle * N[(0.011111111111111112 * N[(N[(b - a), $MachinePrecision] * N[(Pi * N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b = |b|\\
\\
angle \cdot \left(0.011111111111111112 \cdot \left(\left(b - a\right) \cdot \left(\pi \cdot \left(a + b\right)\right)\right)\right)
\end{array}
Initial program 50.4%
associate-*l*50.4%
unpow250.4%
unpow250.4%
difference-of-squares57.2%
Simplified57.2%
Taylor expanded in angle around inf 58.0%
Taylor expanded in angle around 0 54.4%
*-commutative54.4%
*-commutative54.4%
+-commutative54.4%
*-commutative54.4%
associate-*l*54.4%
Simplified54.4%
Final simplification54.4%
NOTE: b should be positive before calling this function (FPCore (a b angle) :precision binary64 (* (* PI (* (- b a) (+ a b))) (* angle 0.011111111111111112)))
b = abs(b);
double code(double a, double b, double angle) {
return (((double) M_PI) * ((b - a) * (a + b))) * (angle * 0.011111111111111112);
}
b = Math.abs(b);
public static double code(double a, double b, double angle) {
return (Math.PI * ((b - a) * (a + b))) * (angle * 0.011111111111111112);
}
b = abs(b) def code(a, b, angle): return (math.pi * ((b - a) * (a + b))) * (angle * 0.011111111111111112)
b = abs(b) function code(a, b, angle) return Float64(Float64(pi * Float64(Float64(b - a) * Float64(a + b))) * Float64(angle * 0.011111111111111112)) end
b = abs(b) function tmp = code(a, b, angle) tmp = (pi * ((b - a) * (a + b))) * (angle * 0.011111111111111112); end
NOTE: b should be positive before calling this function code[a_, b_, angle_] := N[(N[(Pi * N[(N[(b - a), $MachinePrecision] * N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(angle * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b = |b|\\
\\
\left(\pi \cdot \left(\left(b - a\right) \cdot \left(a + b\right)\right)\right) \cdot \left(angle \cdot 0.011111111111111112\right)
\end{array}
Initial program 50.4%
*-commutative50.4%
associate-*l*50.4%
unpow250.4%
fma-neg53.9%
unpow253.9%
Simplified53.9%
Taylor expanded in angle around 0 48.3%
associate-*r*48.4%
*-commutative48.4%
*-commutative48.4%
unpow248.4%
unpow248.4%
sub-neg48.4%
sub-neg48.4%
difference-of-squares54.4%
*-commutative54.4%
+-commutative54.4%
*-commutative54.4%
Simplified54.4%
Final simplification54.4%
NOTE: b should be positive before calling this function (FPCore (a b angle) :precision binary64 (* (* (* (- b a) angle) (* PI (+ a b))) 0.011111111111111112))
b = abs(b);
double code(double a, double b, double angle) {
return (((b - a) * angle) * (((double) M_PI) * (a + b))) * 0.011111111111111112;
}
b = Math.abs(b);
public static double code(double a, double b, double angle) {
return (((b - a) * angle) * (Math.PI * (a + b))) * 0.011111111111111112;
}
b = abs(b) def code(a, b, angle): return (((b - a) * angle) * (math.pi * (a + b))) * 0.011111111111111112
b = abs(b) function code(a, b, angle) return Float64(Float64(Float64(Float64(b - a) * angle) * Float64(pi * Float64(a + b))) * 0.011111111111111112) end
b = abs(b) function tmp = code(a, b, angle) tmp = (((b - a) * angle) * (pi * (a + b))) * 0.011111111111111112; end
NOTE: b should be positive before calling this function code[a_, b_, angle_] := N[(N[(N[(N[(b - a), $MachinePrecision] * angle), $MachinePrecision] * N[(Pi * N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]
\begin{array}{l}
b = |b|\\
\\
\left(\left(\left(b - a\right) \cdot angle\right) \cdot \left(\pi \cdot \left(a + b\right)\right)\right) \cdot 0.011111111111111112
\end{array}
Initial program 50.4%
associate-*l*50.4%
unpow250.4%
unpow250.4%
difference-of-squares57.2%
Simplified57.2%
Taylor expanded in angle around 0 54.4%
*-commutative54.4%
associate-*r*64.4%
Simplified64.4%
Final simplification64.4%
NOTE: b should be positive before calling this function (FPCore (a b angle) :precision binary64 (* angle (* PI (* (* a a) -0.011111111111111112))))
b = abs(b);
double code(double a, double b, double angle) {
return angle * (((double) M_PI) * ((a * a) * -0.011111111111111112));
}
b = Math.abs(b);
public static double code(double a, double b, double angle) {
return angle * (Math.PI * ((a * a) * -0.011111111111111112));
}
b = abs(b) def code(a, b, angle): return angle * (math.pi * ((a * a) * -0.011111111111111112))
b = abs(b) function code(a, b, angle) return Float64(angle * Float64(pi * Float64(Float64(a * a) * -0.011111111111111112))) end
b = abs(b) function tmp = code(a, b, angle) tmp = angle * (pi * ((a * a) * -0.011111111111111112)); end
NOTE: b should be positive before calling this function code[a_, b_, angle_] := N[(angle * N[(Pi * N[(N[(a * a), $MachinePrecision] * -0.011111111111111112), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b = |b|\\
\\
angle \cdot \left(\pi \cdot \left(\left(a \cdot a\right) \cdot -0.011111111111111112\right)\right)
\end{array}
Initial program 50.4%
associate-*l*50.4%
unpow250.4%
unpow250.4%
difference-of-squares57.2%
Simplified57.2%
Taylor expanded in angle around 0 54.4%
Taylor expanded in b around 0 36.2%
*-commutative36.2%
*-commutative36.2%
unpow236.2%
Simplified36.2%
Taylor expanded in angle around 0 36.2%
*-commutative36.2%
*-commutative36.2%
associate-*r*36.2%
associate-*l*36.2%
associate-*r*36.2%
unpow236.2%
Simplified36.2%
Final simplification36.2%
NOTE: b should be positive before calling this function (FPCore (a b angle) :precision binary64 (* PI (* (* a a) (* angle -0.011111111111111112))))
b = abs(b);
double code(double a, double b, double angle) {
return ((double) M_PI) * ((a * a) * (angle * -0.011111111111111112));
}
b = Math.abs(b);
public static double code(double a, double b, double angle) {
return Math.PI * ((a * a) * (angle * -0.011111111111111112));
}
b = abs(b) def code(a, b, angle): return math.pi * ((a * a) * (angle * -0.011111111111111112))
b = abs(b) function code(a, b, angle) return Float64(pi * Float64(Float64(a * a) * Float64(angle * -0.011111111111111112))) end
b = abs(b) function tmp = code(a, b, angle) tmp = pi * ((a * a) * (angle * -0.011111111111111112)); end
NOTE: b should be positive before calling this function code[a_, b_, angle_] := N[(Pi * N[(N[(a * a), $MachinePrecision] * N[(angle * -0.011111111111111112), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b = |b|\\
\\
\pi \cdot \left(\left(a \cdot a\right) \cdot \left(angle \cdot -0.011111111111111112\right)\right)
\end{array}
Initial program 50.4%
associate-*l*50.4%
unpow250.4%
unpow250.4%
difference-of-squares57.2%
Simplified57.2%
Taylor expanded in angle around 0 54.4%
Taylor expanded in b around 0 36.2%
*-commutative36.2%
*-commutative36.2%
unpow236.2%
Simplified36.2%
Taylor expanded in angle around 0 36.2%
*-commutative36.2%
*-commutative36.2%
associate-*r*36.2%
associate-*l*36.2%
associate-*r*36.2%
unpow236.2%
Simplified36.2%
Taylor expanded in angle around 0 36.2%
associate-*r*36.2%
associate-*r*36.2%
*-commutative36.2%
*-commutative36.2%
unpow236.2%
*-commutative36.2%
Simplified36.2%
Final simplification36.2%
herbie shell --seed 2023230
(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)))))