
(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 11 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}
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* 0.005555555555555556 (* angle PI))))
(if (<= (pow a 2.0) 5e+52)
(* 2.0 (* (* (- b a) (cos t_0)) (* (sin t_0) (+ a b))))
(* (* PI (* angle (+ a b))) (* (- b a) 0.011111111111111112)))))
double code(double a, double b, double angle) {
double t_0 = 0.005555555555555556 * (angle * ((double) M_PI));
double tmp;
if (pow(a, 2.0) <= 5e+52) {
tmp = 2.0 * (((b - a) * cos(t_0)) * (sin(t_0) * (a + b)));
} else {
tmp = (((double) M_PI) * (angle * (a + b))) * ((b - a) * 0.011111111111111112);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = 0.005555555555555556 * (angle * Math.PI);
double tmp;
if (Math.pow(a, 2.0) <= 5e+52) {
tmp = 2.0 * (((b - a) * Math.cos(t_0)) * (Math.sin(t_0) * (a + b)));
} else {
tmp = (Math.PI * (angle * (a + b))) * ((b - a) * 0.011111111111111112);
}
return tmp;
}
def code(a, b, angle): t_0 = 0.005555555555555556 * (angle * math.pi) tmp = 0 if math.pow(a, 2.0) <= 5e+52: tmp = 2.0 * (((b - a) * math.cos(t_0)) * (math.sin(t_0) * (a + b))) else: tmp = (math.pi * (angle * (a + b))) * ((b - a) * 0.011111111111111112) return tmp
function code(a, b, angle) t_0 = Float64(0.005555555555555556 * Float64(angle * pi)) tmp = 0.0 if ((a ^ 2.0) <= 5e+52) tmp = Float64(2.0 * Float64(Float64(Float64(b - a) * cos(t_0)) * Float64(sin(t_0) * Float64(a + b)))); else tmp = Float64(Float64(pi * Float64(angle * Float64(a + b))) * Float64(Float64(b - a) * 0.011111111111111112)); end return tmp end
function tmp_2 = code(a, b, angle) t_0 = 0.005555555555555556 * (angle * pi); tmp = 0.0; if ((a ^ 2.0) <= 5e+52) tmp = 2.0 * (((b - a) * cos(t_0)) * (sin(t_0) * (a + b))); else tmp = (pi * (angle * (a + b))) * ((b - a) * 0.011111111111111112); end tmp_2 = tmp; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[a, 2.0], $MachinePrecision], 5e+52], N[(2.0 * N[(N[(N[(b - a), $MachinePrecision] * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision] * N[(N[Sin[t$95$0], $MachinePrecision] * N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * N[(angle * N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(b - a), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.005555555555555556 \cdot \left(angle \cdot \pi\right)\\
\mathbf{if}\;{a}^{2} \leq 5 \cdot 10^{+52}:\\
\;\;\;\;2 \cdot \left(\left(\left(b - a\right) \cdot \cos t_0\right) \cdot \left(\sin t_0 \cdot \left(a + b\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\pi \cdot \left(angle \cdot \left(a + b\right)\right)\right) \cdot \left(\left(b - a\right) \cdot 0.011111111111111112\right)\\
\end{array}
\end{array}
if (pow.f64 a 2) < 5e52Initial program 61.2%
associate-*l*61.2%
unpow261.2%
unpow261.2%
difference-of-squares61.2%
Simplified61.2%
Taylor expanded in angle around inf 64.4%
associate-*r*64.4%
+-commutative64.4%
Simplified64.4%
if 5e52 < (pow.f64 a 2) Initial program 39.4%
associate-*l*39.4%
unpow239.4%
unpow239.4%
difference-of-squares50.6%
Simplified50.6%
Taylor expanded in angle around 0 56.5%
associate-*r*75.0%
*-commutative75.0%
+-commutative75.0%
Simplified75.0%
*-commutative75.0%
+-commutative75.0%
associate-*r*56.5%
pow156.5%
associate-*r*75.0%
+-commutative75.0%
*-commutative75.0%
associate-*l*75.1%
Applied egg-rr75.1%
Taylor expanded in angle around 0 56.5%
associate-*r*75.0%
*-commutative75.0%
+-commutative75.0%
*-commutative75.0%
+-commutative75.0%
associate-*l*75.1%
+-commutative75.1%
*-commutative75.1%
+-commutative75.1%
Simplified75.1%
Taylor expanded in angle around 0 56.5%
*-commutative56.5%
+-commutative56.5%
associate-*r*75.1%
*-commutative75.1%
associate-*r*75.8%
*-commutative75.8%
associate-*r*75.8%
*-commutative75.8%
associate-*l*75.8%
+-commutative75.8%
Simplified75.8%
Final simplification69.3%
(FPCore (a b angle)
:precision binary64
(if (<= (pow a 2.0) 1.2e-208)
(*
(* 2.0 (* b (* b (sin (* angle (* 0.005555555555555556 PI))))))
(cos (* PI (/ angle 180.0))))
(* (* PI (* angle (+ a b))) (* (- b a) 0.011111111111111112))))
double code(double a, double b, double angle) {
double tmp;
if (pow(a, 2.0) <= 1.2e-208) {
tmp = (2.0 * (b * (b * sin((angle * (0.005555555555555556 * ((double) M_PI))))))) * cos((((double) M_PI) * (angle / 180.0)));
} else {
tmp = (((double) M_PI) * (angle * (a + b))) * ((b - a) * 0.011111111111111112);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (Math.pow(a, 2.0) <= 1.2e-208) {
tmp = (2.0 * (b * (b * Math.sin((angle * (0.005555555555555556 * Math.PI)))))) * Math.cos((Math.PI * (angle / 180.0)));
} else {
tmp = (Math.PI * (angle * (a + b))) * ((b - a) * 0.011111111111111112);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if math.pow(a, 2.0) <= 1.2e-208: tmp = (2.0 * (b * (b * math.sin((angle * (0.005555555555555556 * math.pi)))))) * math.cos((math.pi * (angle / 180.0))) else: tmp = (math.pi * (angle * (a + b))) * ((b - a) * 0.011111111111111112) return tmp
function code(a, b, angle) tmp = 0.0 if ((a ^ 2.0) <= 1.2e-208) tmp = Float64(Float64(2.0 * Float64(b * Float64(b * sin(Float64(angle * Float64(0.005555555555555556 * pi)))))) * cos(Float64(pi * Float64(angle / 180.0)))); else tmp = Float64(Float64(pi * Float64(angle * Float64(a + b))) * Float64(Float64(b - a) * 0.011111111111111112)); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if ((a ^ 2.0) <= 1.2e-208) tmp = (2.0 * (b * (b * sin((angle * (0.005555555555555556 * pi)))))) * cos((pi * (angle / 180.0))); else tmp = (pi * (angle * (a + b))) * ((b - a) * 0.011111111111111112); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[N[Power[a, 2.0], $MachinePrecision], 1.2e-208], N[(N[(2.0 * N[(b * N[(b * N[Sin[N[(angle * N[(0.005555555555555556 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(Pi * N[(angle * N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(b - a), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{a}^{2} \leq 1.2 \cdot 10^{-208}:\\
\;\;\;\;\left(2 \cdot \left(b \cdot \left(b \cdot \sin \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\pi \cdot \left(angle \cdot \left(a + b\right)\right)\right) \cdot \left(\left(b - a\right) \cdot 0.011111111111111112\right)\\
\end{array}
\end{array}
if (pow.f64 a 2) < 1.1999999999999999e-208Initial program 61.0%
*-commutative61.0%
associate-*l*61.0%
unpow261.0%
fma-neg61.0%
unpow261.0%
distribute-rgt-neg-in61.0%
Simplified61.0%
Taylor expanded in b around inf 62.1%
unpow262.1%
associate-*r*62.1%
*-commutative62.1%
*-commutative62.1%
associate-*r*61.8%
*-commutative61.8%
associate-*r*62.1%
*-commutative62.1%
*-commutative62.1%
Simplified62.1%
Taylor expanded in angle around inf 62.1%
unpow262.1%
*-commutative62.1%
*-commutative62.1%
associate-*r*61.8%
associate-*l*63.9%
associate-*r*64.3%
*-commutative64.3%
*-commutative64.3%
*-commutative64.3%
associate-*l*65.1%
Simplified65.1%
if 1.1999999999999999e-208 < (pow.f64 a 2) Initial program 47.1%
associate-*l*47.1%
unpow247.1%
unpow247.1%
difference-of-squares54.4%
Simplified54.4%
Taylor expanded in angle around 0 56.5%
associate-*r*69.6%
*-commutative69.6%
+-commutative69.6%
Simplified69.6%
*-commutative69.6%
+-commutative69.6%
associate-*r*56.5%
pow156.5%
associate-*r*69.6%
+-commutative69.6%
*-commutative69.6%
associate-*l*69.6%
Applied egg-rr69.6%
Taylor expanded in angle around 0 56.5%
associate-*r*69.6%
*-commutative69.6%
+-commutative69.6%
*-commutative69.6%
+-commutative69.6%
associate-*l*69.6%
+-commutative69.6%
*-commutative69.6%
+-commutative69.6%
Simplified69.6%
Taylor expanded in angle around 0 56.5%
*-commutative56.5%
+-commutative56.5%
associate-*r*69.6%
*-commutative69.6%
associate-*r*70.1%
*-commutative70.1%
associate-*r*70.1%
*-commutative70.1%
associate-*l*70.1%
+-commutative70.1%
Simplified70.1%
Final simplification68.4%
(FPCore (a b angle) :precision binary64 (if (<= (pow a 2.0) 1.2e-208) (* b (* b (sin (* PI (* angle 0.011111111111111112))))) (* (* PI (* angle (+ a b))) (* (- b a) 0.011111111111111112))))
double code(double a, double b, double angle) {
double tmp;
if (pow(a, 2.0) <= 1.2e-208) {
tmp = b * (b * sin((((double) M_PI) * (angle * 0.011111111111111112))));
} else {
tmp = (((double) M_PI) * (angle * (a + b))) * ((b - a) * 0.011111111111111112);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (Math.pow(a, 2.0) <= 1.2e-208) {
tmp = b * (b * Math.sin((Math.PI * (angle * 0.011111111111111112))));
} else {
tmp = (Math.PI * (angle * (a + b))) * ((b - a) * 0.011111111111111112);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if math.pow(a, 2.0) <= 1.2e-208: tmp = b * (b * math.sin((math.pi * (angle * 0.011111111111111112)))) else: tmp = (math.pi * (angle * (a + b))) * ((b - a) * 0.011111111111111112) return tmp
function code(a, b, angle) tmp = 0.0 if ((a ^ 2.0) <= 1.2e-208) tmp = Float64(b * Float64(b * sin(Float64(pi * Float64(angle * 0.011111111111111112))))); else tmp = Float64(Float64(pi * Float64(angle * Float64(a + b))) * Float64(Float64(b - a) * 0.011111111111111112)); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if ((a ^ 2.0) <= 1.2e-208) tmp = b * (b * sin((pi * (angle * 0.011111111111111112)))); else tmp = (pi * (angle * (a + b))) * ((b - a) * 0.011111111111111112); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[N[Power[a, 2.0], $MachinePrecision], 1.2e-208], N[(b * N[(b * N[Sin[N[(Pi * N[(angle * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * N[(angle * N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(b - a), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{a}^{2} \leq 1.2 \cdot 10^{-208}:\\
\;\;\;\;b \cdot \left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.011111111111111112\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\pi \cdot \left(angle \cdot \left(a + b\right)\right)\right) \cdot \left(\left(b - a\right) \cdot 0.011111111111111112\right)\\
\end{array}
\end{array}
if (pow.f64 a 2) < 1.1999999999999999e-208Initial program 61.0%
*-commutative61.0%
associate-*l*61.0%
unpow261.0%
fma-neg61.0%
unpow261.0%
Simplified61.0%
Applied egg-rr51.5%
Taylor expanded in b around inf 61.3%
*-commutative61.3%
unpow261.3%
associate-*l*63.4%
associate-*r*65.0%
*-commutative65.0%
*-commutative65.0%
metadata-eval65.0%
associate-*l*65.0%
associate-*l*65.0%
metadata-eval65.0%
Simplified65.0%
if 1.1999999999999999e-208 < (pow.f64 a 2) Initial program 47.1%
associate-*l*47.1%
unpow247.1%
unpow247.1%
difference-of-squares54.4%
Simplified54.4%
Taylor expanded in angle around 0 56.5%
associate-*r*69.6%
*-commutative69.6%
+-commutative69.6%
Simplified69.6%
*-commutative69.6%
+-commutative69.6%
associate-*r*56.5%
pow156.5%
associate-*r*69.6%
+-commutative69.6%
*-commutative69.6%
associate-*l*69.6%
Applied egg-rr69.6%
Taylor expanded in angle around 0 56.5%
associate-*r*69.6%
*-commutative69.6%
+-commutative69.6%
*-commutative69.6%
+-commutative69.6%
associate-*l*69.6%
+-commutative69.6%
*-commutative69.6%
+-commutative69.6%
Simplified69.6%
Taylor expanded in angle around 0 56.5%
*-commutative56.5%
+-commutative56.5%
associate-*r*69.6%
*-commutative69.6%
associate-*r*70.1%
*-commutative70.1%
associate-*r*70.1%
*-commutative70.1%
associate-*l*70.1%
+-commutative70.1%
Simplified70.1%
Final simplification68.4%
(FPCore (a b angle) :precision binary64 (if (<= a 5.8e+144) (* 0.011111111111111112 (* angle (* (- b a) (* PI (+ a b))))) (* 0.011111111111111112 (* (* (- b a) angle) (* a PI)))))
double code(double a, double b, double angle) {
double tmp;
if (a <= 5.8e+144) {
tmp = 0.011111111111111112 * (angle * ((b - a) * (((double) M_PI) * (a + b))));
} else {
tmp = 0.011111111111111112 * (((b - a) * angle) * (a * ((double) M_PI)));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 5.8e+144) {
tmp = 0.011111111111111112 * (angle * ((b - a) * (Math.PI * (a + b))));
} else {
tmp = 0.011111111111111112 * (((b - a) * angle) * (a * Math.PI));
}
return tmp;
}
def code(a, b, angle): tmp = 0 if a <= 5.8e+144: tmp = 0.011111111111111112 * (angle * ((b - a) * (math.pi * (a + b)))) else: tmp = 0.011111111111111112 * (((b - a) * angle) * (a * math.pi)) return tmp
function code(a, b, angle) tmp = 0.0 if (a <= 5.8e+144) tmp = Float64(0.011111111111111112 * Float64(angle * Float64(Float64(b - a) * Float64(pi * Float64(a + b))))); else tmp = Float64(0.011111111111111112 * Float64(Float64(Float64(b - a) * angle) * Float64(a * pi))); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 5.8e+144) tmp = 0.011111111111111112 * (angle * ((b - a) * (pi * (a + b)))); else tmp = 0.011111111111111112 * (((b - a) * angle) * (a * pi)); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[a, 5.8e+144], N[(0.011111111111111112 * N[(angle * N[(N[(b - a), $MachinePrecision] * N[(Pi * N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.011111111111111112 * N[(N[(N[(b - a), $MachinePrecision] * angle), $MachinePrecision] * N[(a * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 5.8 \cdot 10^{+144}:\\
\;\;\;\;0.011111111111111112 \cdot \left(angle \cdot \left(\left(b - a\right) \cdot \left(\pi \cdot \left(a + b\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.011111111111111112 \cdot \left(\left(\left(b - a\right) \cdot angle\right) \cdot \left(a \cdot \pi\right)\right)\\
\end{array}
\end{array}
if a < 5.79999999999999996e144Initial program 55.3%
associate-*l*55.2%
unpow255.2%
unpow255.2%
difference-of-squares57.2%
Simplified57.2%
Taylor expanded in angle around 0 57.6%
if 5.79999999999999996e144 < a Initial program 30.2%
associate-*l*30.2%
unpow230.2%
unpow230.2%
difference-of-squares53.4%
Simplified53.4%
Taylor expanded in angle around 0 53.4%
associate-*r*82.5%
*-commutative82.5%
+-commutative82.5%
Simplified82.5%
Taylor expanded in b around 0 65.7%
Final simplification58.7%
(FPCore (a b angle) :precision binary64 (if (<= a 3.3e+60) (* 0.011111111111111112 (* angle (* PI (* b b)))) (* 0.011111111111111112 (* (* (- b a) angle) (* a PI)))))
double code(double a, double b, double angle) {
double tmp;
if (a <= 3.3e+60) {
tmp = 0.011111111111111112 * (angle * (((double) M_PI) * (b * b)));
} else {
tmp = 0.011111111111111112 * (((b - a) * angle) * (a * ((double) M_PI)));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 3.3e+60) {
tmp = 0.011111111111111112 * (angle * (Math.PI * (b * b)));
} else {
tmp = 0.011111111111111112 * (((b - a) * angle) * (a * Math.PI));
}
return tmp;
}
def code(a, b, angle): tmp = 0 if a <= 3.3e+60: tmp = 0.011111111111111112 * (angle * (math.pi * (b * b))) else: tmp = 0.011111111111111112 * (((b - a) * angle) * (a * math.pi)) return tmp
function code(a, b, angle) tmp = 0.0 if (a <= 3.3e+60) tmp = Float64(0.011111111111111112 * Float64(angle * Float64(pi * Float64(b * b)))); else tmp = Float64(0.011111111111111112 * Float64(Float64(Float64(b - a) * angle) * Float64(a * pi))); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 3.3e+60) tmp = 0.011111111111111112 * (angle * (pi * (b * b))); else tmp = 0.011111111111111112 * (((b - a) * angle) * (a * pi)); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[a, 3.3e+60], N[(0.011111111111111112 * N[(angle * N[(Pi * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.011111111111111112 * N[(N[(N[(b - a), $MachinePrecision] * angle), $MachinePrecision] * N[(a * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 3.3 \cdot 10^{+60}:\\
\;\;\;\;0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \left(b \cdot b\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.011111111111111112 \cdot \left(\left(\left(b - a\right) \cdot angle\right) \cdot \left(a \cdot \pi\right)\right)\\
\end{array}
\end{array}
if a < 3.2999999999999998e60Initial program 56.4%
associate-*l*56.4%
unpow256.4%
unpow256.4%
difference-of-squares58.5%
Simplified58.5%
Taylor expanded in angle around 0 58.5%
associate-*r*62.9%
*-commutative62.9%
+-commutative62.9%
Simplified62.9%
Taylor expanded in b around inf 43.4%
*-commutative43.4%
unpow243.4%
Simplified43.4%
if 3.2999999999999998e60 < a Initial program 32.3%
associate-*l*32.3%
unpow232.3%
unpow232.3%
difference-of-squares48.9%
Simplified48.9%
Taylor expanded in angle around 0 50.9%
associate-*r*75.7%
*-commutative75.7%
+-commutative75.7%
Simplified75.7%
Taylor expanded in b around 0 57.7%
Final simplification46.1%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* (- b a) angle)))
(if (<= b 8.6e-7)
(* 0.011111111111111112 (* t_0 (* a PI)))
(* 0.011111111111111112 (* t_0 (* b PI))))))
double code(double a, double b, double angle) {
double t_0 = (b - a) * angle;
double tmp;
if (b <= 8.6e-7) {
tmp = 0.011111111111111112 * (t_0 * (a * ((double) M_PI)));
} else {
tmp = 0.011111111111111112 * (t_0 * (b * ((double) M_PI)));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = (b - a) * angle;
double tmp;
if (b <= 8.6e-7) {
tmp = 0.011111111111111112 * (t_0 * (a * Math.PI));
} else {
tmp = 0.011111111111111112 * (t_0 * (b * Math.PI));
}
return tmp;
}
def code(a, b, angle): t_0 = (b - a) * angle tmp = 0 if b <= 8.6e-7: tmp = 0.011111111111111112 * (t_0 * (a * math.pi)) else: tmp = 0.011111111111111112 * (t_0 * (b * math.pi)) return tmp
function code(a, b, angle) t_0 = Float64(Float64(b - a) * angle) tmp = 0.0 if (b <= 8.6e-7) tmp = Float64(0.011111111111111112 * Float64(t_0 * Float64(a * pi))); else tmp = Float64(0.011111111111111112 * Float64(t_0 * Float64(b * pi))); end return tmp end
function tmp_2 = code(a, b, angle) t_0 = (b - a) * angle; tmp = 0.0; if (b <= 8.6e-7) tmp = 0.011111111111111112 * (t_0 * (a * pi)); else tmp = 0.011111111111111112 * (t_0 * (b * pi)); end tmp_2 = tmp; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[(b - a), $MachinePrecision] * angle), $MachinePrecision]}, If[LessEqual[b, 8.6e-7], N[(0.011111111111111112 * N[(t$95$0 * N[(a * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.011111111111111112 * N[(t$95$0 * N[(b * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(b - a\right) \cdot angle\\
\mathbf{if}\;b \leq 8.6 \cdot 10^{-7}:\\
\;\;\;\;0.011111111111111112 \cdot \left(t_0 \cdot \left(a \cdot \pi\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.011111111111111112 \cdot \left(t_0 \cdot \left(b \cdot \pi\right)\right)\\
\end{array}
\end{array}
if b < 8.6000000000000002e-7Initial program 53.5%
associate-*l*53.5%
unpow253.5%
unpow253.5%
difference-of-squares57.6%
Simplified57.6%
Taylor expanded in angle around 0 55.9%
associate-*r*63.3%
*-commutative63.3%
+-commutative63.3%
Simplified63.3%
Taylor expanded in b around 0 47.6%
if 8.6000000000000002e-7 < b Initial program 46.0%
associate-*l*46.0%
unpow246.0%
unpow246.0%
difference-of-squares53.2%
Simplified53.2%
Taylor expanded in angle around 0 60.9%
associate-*r*72.4%
*-commutative72.4%
+-commutative72.4%
Simplified72.4%
Taylor expanded in b around inf 65.1%
*-commutative65.1%
Simplified65.1%
Final simplification51.5%
(FPCore (a b angle) :precision binary64 (* 0.011111111111111112 (* (* (- b a) angle) (* PI (+ a b)))))
double code(double a, double b, double angle) {
return 0.011111111111111112 * (((b - a) * angle) * (((double) M_PI) * (a + b)));
}
public static double code(double a, double b, double angle) {
return 0.011111111111111112 * (((b - a) * angle) * (Math.PI * (a + b)));
}
def code(a, b, angle): return 0.011111111111111112 * (((b - a) * angle) * (math.pi * (a + b)))
function code(a, b, angle) return Float64(0.011111111111111112 * Float64(Float64(Float64(b - a) * angle) * Float64(pi * Float64(a + b)))) end
function tmp = code(a, b, angle) tmp = 0.011111111111111112 * (((b - a) * angle) * (pi * (a + b))); end
code[a_, b_, angle_] := N[(0.011111111111111112 * N[(N[(N[(b - a), $MachinePrecision] * angle), $MachinePrecision] * N[(Pi * N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.011111111111111112 \cdot \left(\left(\left(b - a\right) \cdot angle\right) \cdot \left(\pi \cdot \left(a + b\right)\right)\right)
\end{array}
Initial program 51.8%
associate-*l*51.8%
unpow251.8%
unpow251.8%
difference-of-squares56.6%
Simplified56.6%
Taylor expanded in angle around 0 57.0%
associate-*r*65.3%
*-commutative65.3%
+-commutative65.3%
Simplified65.3%
Final simplification65.3%
(FPCore (a b angle) :precision binary64 (* 0.011111111111111112 (* PI (* (+ a b) (* (- b a) angle)))))
double code(double a, double b, double angle) {
return 0.011111111111111112 * (((double) M_PI) * ((a + b) * ((b - a) * angle)));
}
public static double code(double a, double b, double angle) {
return 0.011111111111111112 * (Math.PI * ((a + b) * ((b - a) * angle)));
}
def code(a, b, angle): return 0.011111111111111112 * (math.pi * ((a + b) * ((b - a) * angle)))
function code(a, b, angle) return Float64(0.011111111111111112 * Float64(pi * Float64(Float64(a + b) * Float64(Float64(b - a) * angle)))) end
function tmp = code(a, b, angle) tmp = 0.011111111111111112 * (pi * ((a + b) * ((b - a) * angle))); end
code[a_, b_, angle_] := N[(0.011111111111111112 * N[(Pi * N[(N[(a + b), $MachinePrecision] * N[(N[(b - a), $MachinePrecision] * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.011111111111111112 \cdot \left(\pi \cdot \left(\left(a + b\right) \cdot \left(\left(b - a\right) \cdot angle\right)\right)\right)
\end{array}
Initial program 51.8%
associate-*l*51.8%
unpow251.8%
unpow251.8%
difference-of-squares56.6%
Simplified56.6%
Taylor expanded in angle around 0 57.0%
associate-*r*65.3%
*-commutative65.3%
+-commutative65.3%
Simplified65.3%
*-commutative65.3%
+-commutative65.3%
associate-*r*57.0%
pow157.0%
associate-*r*65.3%
+-commutative65.3%
*-commutative65.3%
associate-*l*65.3%
Applied egg-rr65.3%
Final simplification65.3%
(FPCore (a b angle) :precision binary64 (if (<= a 9.5e+75) (* 0.011111111111111112 (* angle (* PI (* b b)))) (* -0.011111111111111112 (* PI (* angle (* a a))))))
double code(double a, double b, double angle) {
double tmp;
if (a <= 9.5e+75) {
tmp = 0.011111111111111112 * (angle * (((double) M_PI) * (b * b)));
} else {
tmp = -0.011111111111111112 * (((double) M_PI) * (angle * (a * a)));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 9.5e+75) {
tmp = 0.011111111111111112 * (angle * (Math.PI * (b * b)));
} else {
tmp = -0.011111111111111112 * (Math.PI * (angle * (a * a)));
}
return tmp;
}
def code(a, b, angle): tmp = 0 if a <= 9.5e+75: tmp = 0.011111111111111112 * (angle * (math.pi * (b * b))) else: tmp = -0.011111111111111112 * (math.pi * (angle * (a * a))) return tmp
function code(a, b, angle) tmp = 0.0 if (a <= 9.5e+75) tmp = Float64(0.011111111111111112 * Float64(angle * Float64(pi * Float64(b * b)))); else tmp = Float64(-0.011111111111111112 * Float64(pi * Float64(angle * Float64(a * a)))); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 9.5e+75) tmp = 0.011111111111111112 * (angle * (pi * (b * b))); else tmp = -0.011111111111111112 * (pi * (angle * (a * a))); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[a, 9.5e+75], N[(0.011111111111111112 * N[(angle * N[(Pi * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.011111111111111112 * N[(Pi * N[(angle * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 9.5 \cdot 10^{+75}:\\
\;\;\;\;0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \left(b \cdot b\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-0.011111111111111112 \cdot \left(\pi \cdot \left(angle \cdot \left(a \cdot a\right)\right)\right)\\
\end{array}
\end{array}
if a < 9.50000000000000061e75Initial program 55.7%
associate-*l*55.7%
unpow255.7%
unpow255.7%
difference-of-squares57.8%
Simplified57.8%
Taylor expanded in angle around 0 57.7%
associate-*r*62.1%
*-commutative62.1%
+-commutative62.1%
Simplified62.1%
Taylor expanded in b around inf 42.8%
*-commutative42.8%
unpow242.8%
Simplified42.8%
if 9.50000000000000061e75 < a Initial program 34.0%
associate-*l*34.0%
unpow234.0%
unpow234.0%
difference-of-squares51.6%
Simplified51.6%
Taylor expanded in angle around 0 53.8%
associate-*r*80.2%
*-commutative80.2%
+-commutative80.2%
Simplified80.2%
Taylor expanded in b around 0 44.8%
associate-*r*44.9%
unpow244.9%
Simplified44.9%
Final simplification43.2%
(FPCore (a b angle) :precision binary64 (* -0.011111111111111112 (* angle (* a (* a PI)))))
double code(double a, double b, double angle) {
return -0.011111111111111112 * (angle * (a * (a * ((double) M_PI))));
}
public static double code(double a, double b, double angle) {
return -0.011111111111111112 * (angle * (a * (a * Math.PI)));
}
def code(a, b, angle): return -0.011111111111111112 * (angle * (a * (a * math.pi)))
function code(a, b, angle) return Float64(-0.011111111111111112 * Float64(angle * Float64(a * Float64(a * pi)))) end
function tmp = code(a, b, angle) tmp = -0.011111111111111112 * (angle * (a * (a * pi))); end
code[a_, b_, angle_] := N[(-0.011111111111111112 * N[(angle * N[(a * N[(a * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.011111111111111112 \cdot \left(angle \cdot \left(a \cdot \left(a \cdot \pi\right)\right)\right)
\end{array}
Initial program 51.8%
associate-*l*51.8%
unpow251.8%
unpow251.8%
difference-of-squares56.6%
Simplified56.6%
Taylor expanded in angle around 0 57.0%
associate-*r*65.3%
*-commutative65.3%
+-commutative65.3%
Simplified65.3%
Taylor expanded in b around 0 34.2%
associate-*r*34.2%
unpow234.2%
Simplified34.2%
Taylor expanded in angle around 0 34.2%
unpow234.2%
associate-*l*34.2%
Simplified34.2%
Final simplification34.2%
(FPCore (a b angle) :precision binary64 (* -0.011111111111111112 (* PI (* angle (* a a)))))
double code(double a, double b, double angle) {
return -0.011111111111111112 * (((double) M_PI) * (angle * (a * a)));
}
public static double code(double a, double b, double angle) {
return -0.011111111111111112 * (Math.PI * (angle * (a * a)));
}
def code(a, b, angle): return -0.011111111111111112 * (math.pi * (angle * (a * a)))
function code(a, b, angle) return Float64(-0.011111111111111112 * Float64(pi * Float64(angle * Float64(a * a)))) end
function tmp = code(a, b, angle) tmp = -0.011111111111111112 * (pi * (angle * (a * a))); end
code[a_, b_, angle_] := N[(-0.011111111111111112 * N[(Pi * N[(angle * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.011111111111111112 \cdot \left(\pi \cdot \left(angle \cdot \left(a \cdot a\right)\right)\right)
\end{array}
Initial program 51.8%
associate-*l*51.8%
unpow251.8%
unpow251.8%
difference-of-squares56.6%
Simplified56.6%
Taylor expanded in angle around 0 57.0%
associate-*r*65.3%
*-commutative65.3%
+-commutative65.3%
Simplified65.3%
Taylor expanded in b around 0 34.2%
associate-*r*34.2%
unpow234.2%
Simplified34.2%
Final simplification34.2%
herbie shell --seed 2023227
(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)))))