
(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 9 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: a should be positive before calling this function
NOTE: b should be positive before calling this function
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* angle (/ PI -180.0)))
(t_1 (* (- a b) (+ a b)))
(t_2 (cos (* (/ angle 180.0) PI))))
(if (<= (/ angle 180.0) -2e+49)
(*
(* 2.0 (sin t_0))
(* (cos (* angle (/ (pow (sqrt PI) 2.0) -180.0))) t_1))
(if (<= (/ angle 180.0) 0.2)
(* (* 2.0 (* (* (sin (/ angle (/ 180.0 PI))) (+ a b)) (- b a))) t_2)
(if (<= (/ angle 180.0) 2e+166)
(*
(* 2.0 (sin (* angle (/ (cbrt (pow PI 3.0)) -180.0))))
(* t_1 (cos t_0)))
(*
t_2
(* 2.0 (* (- b a) (* (+ a b) (sin (/ (* angle PI) 180.0)))))))))))a = abs(a);
b = abs(b);
double code(double a, double b, double angle) {
double t_0 = angle * (((double) M_PI) / -180.0);
double t_1 = (a - b) * (a + b);
double t_2 = cos(((angle / 180.0) * ((double) M_PI)));
double tmp;
if ((angle / 180.0) <= -2e+49) {
tmp = (2.0 * sin(t_0)) * (cos((angle * (pow(sqrt(((double) M_PI)), 2.0) / -180.0))) * t_1);
} else if ((angle / 180.0) <= 0.2) {
tmp = (2.0 * ((sin((angle / (180.0 / ((double) M_PI)))) * (a + b)) * (b - a))) * t_2;
} else if ((angle / 180.0) <= 2e+166) {
tmp = (2.0 * sin((angle * (cbrt(pow(((double) M_PI), 3.0)) / -180.0)))) * (t_1 * cos(t_0));
} else {
tmp = t_2 * (2.0 * ((b - a) * ((a + b) * sin(((angle * ((double) M_PI)) / 180.0)))));
}
return tmp;
}
a = Math.abs(a);
b = Math.abs(b);
public static double code(double a, double b, double angle) {
double t_0 = angle * (Math.PI / -180.0);
double t_1 = (a - b) * (a + b);
double t_2 = Math.cos(((angle / 180.0) * Math.PI));
double tmp;
if ((angle / 180.0) <= -2e+49) {
tmp = (2.0 * Math.sin(t_0)) * (Math.cos((angle * (Math.pow(Math.sqrt(Math.PI), 2.0) / -180.0))) * t_1);
} else if ((angle / 180.0) <= 0.2) {
tmp = (2.0 * ((Math.sin((angle / (180.0 / Math.PI))) * (a + b)) * (b - a))) * t_2;
} else if ((angle / 180.0) <= 2e+166) {
tmp = (2.0 * Math.sin((angle * (Math.cbrt(Math.pow(Math.PI, 3.0)) / -180.0)))) * (t_1 * Math.cos(t_0));
} else {
tmp = t_2 * (2.0 * ((b - a) * ((a + b) * Math.sin(((angle * Math.PI) / 180.0)))));
}
return tmp;
}
a = abs(a) b = abs(b) function code(a, b, angle) t_0 = Float64(angle * Float64(pi / -180.0)) t_1 = Float64(Float64(a - b) * Float64(a + b)) t_2 = cos(Float64(Float64(angle / 180.0) * pi)) tmp = 0.0 if (Float64(angle / 180.0) <= -2e+49) tmp = Float64(Float64(2.0 * sin(t_0)) * Float64(cos(Float64(angle * Float64((sqrt(pi) ^ 2.0) / -180.0))) * t_1)); elseif (Float64(angle / 180.0) <= 0.2) tmp = Float64(Float64(2.0 * Float64(Float64(sin(Float64(angle / Float64(180.0 / pi))) * Float64(a + b)) * Float64(b - a))) * t_2); elseif (Float64(angle / 180.0) <= 2e+166) tmp = Float64(Float64(2.0 * sin(Float64(angle * Float64(cbrt((pi ^ 3.0)) / -180.0)))) * Float64(t_1 * cos(t_0))); else tmp = Float64(t_2 * Float64(2.0 * Float64(Float64(b - a) * Float64(Float64(a + b) * sin(Float64(Float64(angle * pi) / 180.0)))))); end return tmp end
NOTE: a should be positive before calling this function
NOTE: b should be positive before calling this function
code[a_, b_, angle_] := Block[{t$95$0 = N[(angle * N[(Pi / -180.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(a - b), $MachinePrecision] * N[(a + b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(angle / 180.0), $MachinePrecision], -2e+49], N[(N[(2.0 * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision] * N[(N[Cos[N[(angle * N[(N[Power[N[Sqrt[Pi], $MachinePrecision], 2.0], $MachinePrecision] / -180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle / 180.0), $MachinePrecision], 0.2], N[(N[(2.0 * N[(N[(N[Sin[N[(angle / N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(a + b), $MachinePrecision]), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[N[(angle / 180.0), $MachinePrecision], 2e+166], N[(N[(2.0 * N[Sin[N[(angle * N[(N[Power[N[Power[Pi, 3.0], $MachinePrecision], 1/3], $MachinePrecision] / -180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 * N[(2.0 * N[(N[(b - a), $MachinePrecision] * N[(N[(a + b), $MachinePrecision] * N[Sin[N[(N[(angle * Pi), $MachinePrecision] / 180.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
a = |a|\\
b = |b|\\
\\
\begin{array}{l}
t_0 := angle \cdot \frac{\pi}{-180}\\
t_1 := \left(a - b\right) \cdot \left(a + b\right)\\
t_2 := \cos \left(\frac{angle}{180} \cdot \pi\right)\\
\mathbf{if}\;\frac{angle}{180} \leq -2 \cdot 10^{+49}:\\
\;\;\;\;\left(2 \cdot \sin t_0\right) \cdot \left(\cos \left(angle \cdot \frac{{\left(\sqrt{\pi}\right)}^{2}}{-180}\right) \cdot t_1\right)\\
\mathbf{elif}\;\frac{angle}{180} \leq 0.2:\\
\;\;\;\;\left(2 \cdot \left(\left(\sin \left(\frac{angle}{\frac{180}{\pi}}\right) \cdot \left(a + b\right)\right) \cdot \left(b - a\right)\right)\right) \cdot t_2\\
\mathbf{elif}\;\frac{angle}{180} \leq 2 \cdot 10^{+166}:\\
\;\;\;\;\left(2 \cdot \sin \left(angle \cdot \frac{\sqrt[3]{{\pi}^{3}}}{-180}\right)\right) \cdot \left(t_1 \cdot \cos t_0\right)\\
\mathbf{else}:\\
\;\;\;\;t_2 \cdot \left(2 \cdot \left(\left(b - a\right) \cdot \left(\left(a + b\right) \cdot \sin \left(\frac{angle \cdot \pi}{180}\right)\right)\right)\right)\\
\end{array}
\end{array}
if (/.f64 angle 180) < -1.99999999999999989e49Initial program 30.6%
Simplified23.0%
unpow223.0%
unpow223.0%
difference-of-squares24.6%
Applied egg-rr24.6%
add-sqr-sqrt41.5%
pow241.5%
Applied egg-rr41.5%
if -1.99999999999999989e49 < (/.f64 angle 180) < 0.20000000000000001Initial program 70.8%
unpow270.8%
unpow270.8%
difference-of-squares76.9%
Applied egg-rr76.9%
add-sqr-sqrt30.6%
sqrt-unprod32.3%
associate-*r/32.3%
associate-*r/32.3%
frac-times32.3%
metadata-eval32.3%
metadata-eval32.3%
frac-times32.3%
associate-*l/32.3%
associate-*l/32.3%
sqrt-unprod10.1%
add-sqr-sqrt18.4%
add-log-exp18.8%
*-commutative18.8%
Applied egg-rr22.7%
Taylor expanded in angle around inf 76.8%
associate-*r*98.9%
associate-*r*99.0%
*-commutative99.0%
*-commutative99.0%
+-commutative99.0%
Simplified99.0%
associate-*r*98.9%
*-commutative98.9%
metadata-eval98.9%
div-inv98.9%
associate-/l*99.0%
Applied egg-rr99.0%
if 0.20000000000000001 < (/.f64 angle 180) < 1.99999999999999988e166Initial program 12.0%
Simplified20.4%
unpow220.4%
unpow220.4%
difference-of-squares23.8%
Applied egg-rr23.8%
add-cbrt-cube37.7%
pow337.7%
Applied egg-rr37.7%
if 1.99999999999999988e166 < (/.f64 angle 180) Initial program 44.5%
unpow244.5%
unpow244.5%
difference-of-squares44.5%
Applied egg-rr44.5%
add-sqr-sqrt32.8%
sqrt-unprod0.0%
associate-*r/0.0%
associate-*r/0.0%
frac-times0.0%
metadata-eval0.0%
metadata-eval0.0%
frac-times0.0%
associate-*l/0.0%
associate-*l/0.0%
sqrt-unprod0.0%
add-sqr-sqrt13.3%
add-log-exp13.3%
*-commutative13.3%
Applied egg-rr38.8%
Taylor expanded in angle around inf 48.3%
associate-*r*48.3%
associate-*r*38.8%
*-commutative38.8%
*-commutative38.8%
+-commutative38.8%
Simplified38.8%
metadata-eval38.8%
div-inv44.5%
associate-*r/48.3%
Applied egg-rr48.3%
Final simplification72.7%
NOTE: a should be positive before calling this function
NOTE: b should be positive before calling this function
(FPCore (a b angle)
:precision binary64
(if (<= (/ angle 180.0) -2e+49)
(*
(* 2.0 (sin (* angle (/ PI -180.0))))
(* (cos (* angle (/ (pow (sqrt PI) 2.0) -180.0))) (* (- a b) (+ a b))))
(*
(cos (* (/ angle 180.0) PI))
(* 2.0 (* (- b a) (* (+ a b) (sin (/ PI (/ 180.0 angle)))))))))a = abs(a);
b = abs(b);
double code(double a, double b, double angle) {
double tmp;
if ((angle / 180.0) <= -2e+49) {
tmp = (2.0 * sin((angle * (((double) M_PI) / -180.0)))) * (cos((angle * (pow(sqrt(((double) M_PI)), 2.0) / -180.0))) * ((a - b) * (a + b)));
} else {
tmp = cos(((angle / 180.0) * ((double) M_PI))) * (2.0 * ((b - a) * ((a + b) * sin((((double) M_PI) / (180.0 / angle))))));
}
return tmp;
}
a = Math.abs(a);
b = Math.abs(b);
public static double code(double a, double b, double angle) {
double tmp;
if ((angle / 180.0) <= -2e+49) {
tmp = (2.0 * Math.sin((angle * (Math.PI / -180.0)))) * (Math.cos((angle * (Math.pow(Math.sqrt(Math.PI), 2.0) / -180.0))) * ((a - b) * (a + b)));
} else {
tmp = Math.cos(((angle / 180.0) * Math.PI)) * (2.0 * ((b - a) * ((a + b) * Math.sin((Math.PI / (180.0 / angle))))));
}
return tmp;
}
a = abs(a) b = abs(b) def code(a, b, angle): tmp = 0 if (angle / 180.0) <= -2e+49: tmp = (2.0 * math.sin((angle * (math.pi / -180.0)))) * (math.cos((angle * (math.pow(math.sqrt(math.pi), 2.0) / -180.0))) * ((a - b) * (a + b))) else: tmp = math.cos(((angle / 180.0) * math.pi)) * (2.0 * ((b - a) * ((a + b) * math.sin((math.pi / (180.0 / angle)))))) return tmp
a = abs(a) b = abs(b) function code(a, b, angle) tmp = 0.0 if (Float64(angle / 180.0) <= -2e+49) tmp = Float64(Float64(2.0 * sin(Float64(angle * Float64(pi / -180.0)))) * Float64(cos(Float64(angle * Float64((sqrt(pi) ^ 2.0) / -180.0))) * Float64(Float64(a - b) * Float64(a + b)))); else tmp = Float64(cos(Float64(Float64(angle / 180.0) * pi)) * Float64(2.0 * Float64(Float64(b - a) * Float64(Float64(a + b) * sin(Float64(pi / Float64(180.0 / angle))))))); end return tmp end
a = abs(a) b = abs(b) function tmp_2 = code(a, b, angle) tmp = 0.0; if ((angle / 180.0) <= -2e+49) tmp = (2.0 * sin((angle * (pi / -180.0)))) * (cos((angle * ((sqrt(pi) ^ 2.0) / -180.0))) * ((a - b) * (a + b))); else tmp = cos(((angle / 180.0) * pi)) * (2.0 * ((b - a) * ((a + b) * sin((pi / (180.0 / angle)))))); end tmp_2 = tmp; end
NOTE: a should be positive before calling this function NOTE: b should be positive before calling this function code[a_, b_, angle_] := If[LessEqual[N[(angle / 180.0), $MachinePrecision], -2e+49], N[(N[(2.0 * N[Sin[N[(angle * N[(Pi / -180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[Cos[N[(angle * N[(N[Power[N[Sqrt[Pi], $MachinePrecision], 2.0], $MachinePrecision] / -180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(a - b), $MachinePrecision] * N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision] * N[(2.0 * N[(N[(b - a), $MachinePrecision] * N[(N[(a + b), $MachinePrecision] * N[Sin[N[(Pi / N[(180.0 / angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
a = |a|\\
b = |b|\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{angle}{180} \leq -2 \cdot 10^{+49}:\\
\;\;\;\;\left(2 \cdot \sin \left(angle \cdot \frac{\pi}{-180}\right)\right) \cdot \left(\cos \left(angle \cdot \frac{{\left(\sqrt{\pi}\right)}^{2}}{-180}\right) \cdot \left(\left(a - b\right) \cdot \left(a + b\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\cos \left(\frac{angle}{180} \cdot \pi\right) \cdot \left(2 \cdot \left(\left(b - a\right) \cdot \left(\left(a + b\right) \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)\right)\right)\\
\end{array}
\end{array}
if (/.f64 angle 180) < -1.99999999999999989e49Initial program 30.6%
Simplified23.0%
unpow223.0%
unpow223.0%
difference-of-squares24.6%
Applied egg-rr24.6%
add-sqr-sqrt41.5%
pow241.5%
Applied egg-rr41.5%
if -1.99999999999999989e49 < (/.f64 angle 180) Initial program 58.5%
unpow258.5%
unpow258.5%
difference-of-squares63.3%
Applied egg-rr63.3%
add-sqr-sqrt30.3%
sqrt-unprod25.3%
associate-*r/25.8%
associate-*r/25.9%
frac-times25.8%
metadata-eval25.8%
metadata-eval25.8%
frac-times25.9%
associate-*l/26.4%
associate-*l/26.4%
sqrt-unprod7.2%
add-sqr-sqrt18.5%
add-log-exp18.8%
*-commutative18.8%
Applied egg-rr24.4%
Taylor expanded in angle around inf 64.4%
associate-*r*80.2%
associate-*r*79.0%
*-commutative79.0%
*-commutative79.0%
+-commutative79.0%
Simplified79.0%
metadata-eval79.0%
div-inv79.1%
associate-*r/80.2%
associate-/l*80.2%
Applied egg-rr80.2%
Final simplification70.7%
NOTE: a should be positive before calling this function
NOTE: b should be positive before calling this function
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* (/ angle 180.0) PI)) (t_1 (* angle (/ PI -180.0))))
(if (<= (/ angle 180.0) -5e+137)
(* (* 2.0 (* (+ a b) (- b a))) (sin t_0))
(if (<= (/ angle 180.0) 1e-66)
(*
(cos t_0)
(* 2.0 (* (- b a) (* (+ a b) (* angle (* PI 0.005555555555555556))))))
(* (* 2.0 (sin t_1)) (* (* (- a b) (+ a b)) (cos t_1)))))))a = abs(a);
b = abs(b);
double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * ((double) M_PI);
double t_1 = angle * (((double) M_PI) / -180.0);
double tmp;
if ((angle / 180.0) <= -5e+137) {
tmp = (2.0 * ((a + b) * (b - a))) * sin(t_0);
} else if ((angle / 180.0) <= 1e-66) {
tmp = cos(t_0) * (2.0 * ((b - a) * ((a + b) * (angle * (((double) M_PI) * 0.005555555555555556)))));
} else {
tmp = (2.0 * sin(t_1)) * (((a - b) * (a + b)) * cos(t_1));
}
return tmp;
}
a = Math.abs(a);
b = Math.abs(b);
public static double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * Math.PI;
double t_1 = angle * (Math.PI / -180.0);
double tmp;
if ((angle / 180.0) <= -5e+137) {
tmp = (2.0 * ((a + b) * (b - a))) * Math.sin(t_0);
} else if ((angle / 180.0) <= 1e-66) {
tmp = Math.cos(t_0) * (2.0 * ((b - a) * ((a + b) * (angle * (Math.PI * 0.005555555555555556)))));
} else {
tmp = (2.0 * Math.sin(t_1)) * (((a - b) * (a + b)) * Math.cos(t_1));
}
return tmp;
}
a = abs(a) b = abs(b) def code(a, b, angle): t_0 = (angle / 180.0) * math.pi t_1 = angle * (math.pi / -180.0) tmp = 0 if (angle / 180.0) <= -5e+137: tmp = (2.0 * ((a + b) * (b - a))) * math.sin(t_0) elif (angle / 180.0) <= 1e-66: tmp = math.cos(t_0) * (2.0 * ((b - a) * ((a + b) * (angle * (math.pi * 0.005555555555555556))))) else: tmp = (2.0 * math.sin(t_1)) * (((a - b) * (a + b)) * math.cos(t_1)) return tmp
a = abs(a) b = abs(b) function code(a, b, angle) t_0 = Float64(Float64(angle / 180.0) * pi) t_1 = Float64(angle * Float64(pi / -180.0)) tmp = 0.0 if (Float64(angle / 180.0) <= -5e+137) tmp = Float64(Float64(2.0 * Float64(Float64(a + b) * Float64(b - a))) * sin(t_0)); elseif (Float64(angle / 180.0) <= 1e-66) tmp = Float64(cos(t_0) * Float64(2.0 * Float64(Float64(b - a) * Float64(Float64(a + b) * Float64(angle * Float64(pi * 0.005555555555555556)))))); else tmp = Float64(Float64(2.0 * sin(t_1)) * Float64(Float64(Float64(a - b) * Float64(a + b)) * cos(t_1))); end return tmp end
a = abs(a) b = abs(b) function tmp_2 = code(a, b, angle) t_0 = (angle / 180.0) * pi; t_1 = angle * (pi / -180.0); tmp = 0.0; if ((angle / 180.0) <= -5e+137) tmp = (2.0 * ((a + b) * (b - a))) * sin(t_0); elseif ((angle / 180.0) <= 1e-66) tmp = cos(t_0) * (2.0 * ((b - a) * ((a + b) * (angle * (pi * 0.005555555555555556))))); else tmp = (2.0 * sin(t_1)) * (((a - b) * (a + b)) * cos(t_1)); end tmp_2 = tmp; end
NOTE: a should be positive before calling this function
NOTE: b should be positive before calling this function
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, Block[{t$95$1 = N[(angle * N[(Pi / -180.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(angle / 180.0), $MachinePrecision], -5e+137], N[(N[(2.0 * N[(N[(a + b), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle / 180.0), $MachinePrecision], 1e-66], N[(N[Cos[t$95$0], $MachinePrecision] * N[(2.0 * N[(N[(b - a), $MachinePrecision] * N[(N[(a + b), $MachinePrecision] * N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(a - b), $MachinePrecision] * N[(a + b), $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
a = |a|\\
b = |b|\\
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
t_1 := angle \cdot \frac{\pi}{-180}\\
\mathbf{if}\;\frac{angle}{180} \leq -5 \cdot 10^{+137}:\\
\;\;\;\;\left(2 \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\right) \cdot \sin t_0\\
\mathbf{elif}\;\frac{angle}{180} \leq 10^{-66}:\\
\;\;\;\;\cos t_0 \cdot \left(2 \cdot \left(\left(b - a\right) \cdot \left(\left(a + b\right) \cdot \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(2 \cdot \sin t_1\right) \cdot \left(\left(\left(a - b\right) \cdot \left(a + b\right)\right) \cdot \cos t_1\right)\\
\end{array}
\end{array}
if (/.f64 angle 180) < -5.0000000000000002e137Initial program 33.2%
unpow233.2%
unpow233.2%
difference-of-squares35.7%
Applied egg-rr35.7%
add-sqr-sqrt45.3%
pow245.3%
Applied egg-rr35.2%
Taylor expanded in angle around 0 38.4%
if -5.0000000000000002e137 < (/.f64 angle 180) < 9.9999999999999998e-67Initial program 63.1%
unpow263.1%
unpow263.1%
difference-of-squares67.8%
Applied egg-rr67.8%
add-sqr-sqrt22.3%
sqrt-unprod29.2%
associate-*r/29.9%
associate-*r/29.8%
frac-times29.8%
metadata-eval29.8%
metadata-eval29.8%
frac-times29.8%
associate-*l/29.8%
associate-*l/29.9%
sqrt-unprod15.7%
add-sqr-sqrt22.5%
add-log-exp22.8%
*-commutative22.8%
Applied egg-rr23.2%
Taylor expanded in angle around inf 66.4%
associate-*r*86.2%
associate-*r*87.1%
*-commutative87.1%
*-commutative87.1%
+-commutative87.1%
Simplified87.1%
Taylor expanded in angle around 0 87.0%
associate-*r*87.1%
*-commutative87.1%
associate-*l*87.1%
Simplified87.1%
if 9.9999999999999998e-67 < (/.f64 angle 180) Initial program 35.0%
Simplified38.2%
unpow238.2%
unpow238.2%
difference-of-squares41.4%
Applied egg-rr41.4%
Final simplification68.4%
NOTE: a should be positive before calling this function NOTE: b should be positive before calling this function (FPCore (a b angle) :precision binary64 (* (* 2.0 (* (- b a) (* (+ a b) (sin (* PI (* angle 0.005555555555555556)))))) (cos (* (* angle PI) 0.005555555555555556))))
a = abs(a);
b = abs(b);
double code(double a, double b, double angle) {
return (2.0 * ((b - a) * ((a + b) * sin((((double) M_PI) * (angle * 0.005555555555555556)))))) * cos(((angle * ((double) M_PI)) * 0.005555555555555556));
}
a = Math.abs(a);
b = Math.abs(b);
public static double code(double a, double b, double angle) {
return (2.0 * ((b - a) * ((a + b) * Math.sin((Math.PI * (angle * 0.005555555555555556)))))) * Math.cos(((angle * Math.PI) * 0.005555555555555556));
}
a = abs(a) b = abs(b) def code(a, b, angle): return (2.0 * ((b - a) * ((a + b) * math.sin((math.pi * (angle * 0.005555555555555556)))))) * math.cos(((angle * math.pi) * 0.005555555555555556))
a = abs(a) b = abs(b) function code(a, b, angle) return Float64(Float64(2.0 * Float64(Float64(b - a) * Float64(Float64(a + b) * sin(Float64(pi * Float64(angle * 0.005555555555555556)))))) * cos(Float64(Float64(angle * pi) * 0.005555555555555556))) end
a = abs(a) b = abs(b) function tmp = code(a, b, angle) tmp = (2.0 * ((b - a) * ((a + b) * sin((pi * (angle * 0.005555555555555556)))))) * cos(((angle * pi) * 0.005555555555555556)); end
NOTE: a should be positive before calling this function NOTE: b should be positive before calling this function code[a_, b_, angle_] := N[(N[(2.0 * N[(N[(b - a), $MachinePrecision] * N[(N[(a + b), $MachinePrecision] * N[Sin[N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(N[(angle * Pi), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a = |a|\\
b = |b|\\
\\
\left(2 \cdot \left(\left(b - a\right) \cdot \left(\left(a + b\right) \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)\right) \cdot \cos \left(\left(angle \cdot \pi\right) \cdot 0.005555555555555556\right)
\end{array}
Initial program 51.6%
unpow251.6%
unpow251.6%
difference-of-squares55.6%
Applied egg-rr55.6%
add-sqr-sqrt22.8%
sqrt-unprod22.9%
associate-*r/23.7%
associate-*r/23.7%
frac-times23.6%
metadata-eval23.6%
metadata-eval23.6%
frac-times23.7%
associate-*l/24.1%
associate-*l/24.1%
sqrt-unprod13.2%
add-sqr-sqrt21.7%
add-log-exp21.9%
*-commutative21.9%
Applied egg-rr26.0%
Taylor expanded in angle around inf 55.0%
associate-*r*66.9%
associate-*r*67.1%
*-commutative67.1%
*-commutative67.1%
+-commutative67.1%
Simplified67.1%
Taylor expanded in angle around inf 67.6%
Final simplification67.6%
NOTE: a should be positive before calling this function
NOTE: b should be positive before calling this function
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* (/ angle 180.0) PI)))
(if (<= (/ angle 180.0) -5e+137)
(* (* 2.0 (* (+ a b) (- b a))) (sin t_0))
(if (<= (/ angle 180.0) 4e-33)
(*
(cos t_0)
(* 2.0 (* (- b a) (* (+ a b) (* angle (* PI 0.005555555555555556))))))
(*
(sin (* PI (* angle 0.011111111111111112)))
(- (pow b 2.0) (pow a 2.0)))))))a = abs(a);
b = abs(b);
double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * ((double) M_PI);
double tmp;
if ((angle / 180.0) <= -5e+137) {
tmp = (2.0 * ((a + b) * (b - a))) * sin(t_0);
} else if ((angle / 180.0) <= 4e-33) {
tmp = cos(t_0) * (2.0 * ((b - a) * ((a + b) * (angle * (((double) M_PI) * 0.005555555555555556)))));
} else {
tmp = sin((((double) M_PI) * (angle * 0.011111111111111112))) * (pow(b, 2.0) - pow(a, 2.0));
}
return tmp;
}
a = Math.abs(a);
b = Math.abs(b);
public static double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * Math.PI;
double tmp;
if ((angle / 180.0) <= -5e+137) {
tmp = (2.0 * ((a + b) * (b - a))) * Math.sin(t_0);
} else if ((angle / 180.0) <= 4e-33) {
tmp = Math.cos(t_0) * (2.0 * ((b - a) * ((a + b) * (angle * (Math.PI * 0.005555555555555556)))));
} else {
tmp = Math.sin((Math.PI * (angle * 0.011111111111111112))) * (Math.pow(b, 2.0) - Math.pow(a, 2.0));
}
return tmp;
}
a = abs(a) b = abs(b) def code(a, b, angle): t_0 = (angle / 180.0) * math.pi tmp = 0 if (angle / 180.0) <= -5e+137: tmp = (2.0 * ((a + b) * (b - a))) * math.sin(t_0) elif (angle / 180.0) <= 4e-33: tmp = math.cos(t_0) * (2.0 * ((b - a) * ((a + b) * (angle * (math.pi * 0.005555555555555556))))) else: tmp = math.sin((math.pi * (angle * 0.011111111111111112))) * (math.pow(b, 2.0) - math.pow(a, 2.0)) return tmp
a = abs(a) b = abs(b) function code(a, b, angle) t_0 = Float64(Float64(angle / 180.0) * pi) tmp = 0.0 if (Float64(angle / 180.0) <= -5e+137) tmp = Float64(Float64(2.0 * Float64(Float64(a + b) * Float64(b - a))) * sin(t_0)); elseif (Float64(angle / 180.0) <= 4e-33) tmp = Float64(cos(t_0) * Float64(2.0 * Float64(Float64(b - a) * Float64(Float64(a + b) * Float64(angle * Float64(pi * 0.005555555555555556)))))); else tmp = Float64(sin(Float64(pi * Float64(angle * 0.011111111111111112))) * Float64((b ^ 2.0) - (a ^ 2.0))); end return tmp end
a = abs(a) b = abs(b) function tmp_2 = code(a, b, angle) t_0 = (angle / 180.0) * pi; tmp = 0.0; if ((angle / 180.0) <= -5e+137) tmp = (2.0 * ((a + b) * (b - a))) * sin(t_0); elseif ((angle / 180.0) <= 4e-33) tmp = cos(t_0) * (2.0 * ((b - a) * ((a + b) * (angle * (pi * 0.005555555555555556))))); else tmp = sin((pi * (angle * 0.011111111111111112))) * ((b ^ 2.0) - (a ^ 2.0)); end tmp_2 = tmp; end
NOTE: a should be positive before calling this function
NOTE: b should be positive before calling this function
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, If[LessEqual[N[(angle / 180.0), $MachinePrecision], -5e+137], N[(N[(2.0 * N[(N[(a + b), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle / 180.0), $MachinePrecision], 4e-33], N[(N[Cos[t$95$0], $MachinePrecision] * N[(2.0 * N[(N[(b - a), $MachinePrecision] * N[(N[(a + b), $MachinePrecision] * N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[N[(Pi * N[(angle * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
a = |a|\\
b = |b|\\
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
\mathbf{if}\;\frac{angle}{180} \leq -5 \cdot 10^{+137}:\\
\;\;\;\;\left(2 \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\right) \cdot \sin t_0\\
\mathbf{elif}\;\frac{angle}{180} \leq 4 \cdot 10^{-33}:\\
\;\;\;\;\cos t_0 \cdot \left(2 \cdot \left(\left(b - a\right) \cdot \left(\left(a + b\right) \cdot \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin \left(\pi \cdot \left(angle \cdot 0.011111111111111112\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\\
\end{array}
\end{array}
if (/.f64 angle 180) < -5.0000000000000002e137Initial program 33.2%
unpow233.2%
unpow233.2%
difference-of-squares35.7%
Applied egg-rr35.7%
add-sqr-sqrt45.3%
pow245.3%
Applied egg-rr35.2%
Taylor expanded in angle around 0 38.4%
if -5.0000000000000002e137 < (/.f64 angle 180) < 4.0000000000000002e-33Initial program 63.6%
unpow263.6%
unpow263.6%
difference-of-squares68.8%
Applied egg-rr68.8%
add-sqr-sqrt24.7%
sqrt-unprod31.4%
associate-*r/32.1%
associate-*r/32.0%
frac-times32.0%
metadata-eval32.0%
metadata-eval32.0%
frac-times32.0%
associate-*l/32.1%
associate-*l/32.1%
sqrt-unprod15.2%
add-sqr-sqrt21.8%
add-log-exp22.1%
*-commutative22.1%
Applied egg-rr22.5%
Taylor expanded in angle around inf 67.4%
associate-*r*86.6%
associate-*r*87.5%
*-commutative87.5%
*-commutative87.5%
+-commutative87.5%
Simplified87.5%
Taylor expanded in angle around 0 87.4%
associate-*r*87.5%
*-commutative87.5%
associate-*l*87.5%
Simplified87.5%
if 4.0000000000000002e-33 < (/.f64 angle 180) Initial program 31.1%
*-commutative31.1%
associate-*l*31.1%
associate-*l*31.1%
Simplified31.1%
add-cbrt-cube24.7%
pow1/319.3%
Applied egg-rr19.7%
Taylor expanded in angle around inf 31.6%
associate-*r*32.9%
Simplified32.9%
Final simplification67.7%
NOTE: a should be positive before calling this function
NOTE: b should be positive before calling this function
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* (/ angle 180.0) PI)))
(if (or (<= (/ angle 180.0) -5e+137) (not (<= (/ angle 180.0) 2e+46)))
(* (* 2.0 (* (+ a b) (- b a))) (sin t_0))
(*
(cos t_0)
(* 2.0 (* (- b a) (* (+ a b) (* angle (* PI 0.005555555555555556)))))))))a = abs(a);
b = abs(b);
double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * ((double) M_PI);
double tmp;
if (((angle / 180.0) <= -5e+137) || !((angle / 180.0) <= 2e+46)) {
tmp = (2.0 * ((a + b) * (b - a))) * sin(t_0);
} else {
tmp = cos(t_0) * (2.0 * ((b - a) * ((a + b) * (angle * (((double) M_PI) * 0.005555555555555556)))));
}
return tmp;
}
a = Math.abs(a);
b = Math.abs(b);
public static double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * Math.PI;
double tmp;
if (((angle / 180.0) <= -5e+137) || !((angle / 180.0) <= 2e+46)) {
tmp = (2.0 * ((a + b) * (b - a))) * Math.sin(t_0);
} else {
tmp = Math.cos(t_0) * (2.0 * ((b - a) * ((a + b) * (angle * (Math.PI * 0.005555555555555556)))));
}
return tmp;
}
a = abs(a) b = abs(b) def code(a, b, angle): t_0 = (angle / 180.0) * math.pi tmp = 0 if ((angle / 180.0) <= -5e+137) or not ((angle / 180.0) <= 2e+46): tmp = (2.0 * ((a + b) * (b - a))) * math.sin(t_0) else: tmp = math.cos(t_0) * (2.0 * ((b - a) * ((a + b) * (angle * (math.pi * 0.005555555555555556))))) return tmp
a = abs(a) b = abs(b) function code(a, b, angle) t_0 = Float64(Float64(angle / 180.0) * pi) tmp = 0.0 if ((Float64(angle / 180.0) <= -5e+137) || !(Float64(angle / 180.0) <= 2e+46)) tmp = Float64(Float64(2.0 * Float64(Float64(a + b) * Float64(b - a))) * sin(t_0)); else tmp = Float64(cos(t_0) * Float64(2.0 * Float64(Float64(b - a) * Float64(Float64(a + b) * Float64(angle * Float64(pi * 0.005555555555555556)))))); end return tmp end
a = abs(a) b = abs(b) function tmp_2 = code(a, b, angle) t_0 = (angle / 180.0) * pi; tmp = 0.0; if (((angle / 180.0) <= -5e+137) || ~(((angle / 180.0) <= 2e+46))) tmp = (2.0 * ((a + b) * (b - a))) * sin(t_0); else tmp = cos(t_0) * (2.0 * ((b - a) * ((a + b) * (angle * (pi * 0.005555555555555556))))); end tmp_2 = tmp; end
NOTE: a should be positive before calling this function
NOTE: b should be positive before calling this function
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, If[Or[LessEqual[N[(angle / 180.0), $MachinePrecision], -5e+137], N[Not[LessEqual[N[(angle / 180.0), $MachinePrecision], 2e+46]], $MachinePrecision]], N[(N[(2.0 * N[(N[(a + b), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], N[(N[Cos[t$95$0], $MachinePrecision] * N[(2.0 * N[(N[(b - a), $MachinePrecision] * N[(N[(a + b), $MachinePrecision] * N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
a = |a|\\
b = |b|\\
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
\mathbf{if}\;\frac{angle}{180} \leq -5 \cdot 10^{+137} \lor \neg \left(\frac{angle}{180} \leq 2 \cdot 10^{+46}\right):\\
\;\;\;\;\left(2 \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\right) \cdot \sin t_0\\
\mathbf{else}:\\
\;\;\;\;\cos t_0 \cdot \left(2 \cdot \left(\left(b - a\right) \cdot \left(\left(a + b\right) \cdot \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right)\right)\\
\end{array}
\end{array}
if (/.f64 angle 180) < -5.0000000000000002e137 or 2e46 < (/.f64 angle 180) Initial program 31.6%
unpow231.6%
unpow231.6%
difference-of-squares34.0%
Applied egg-rr34.0%
add-sqr-sqrt38.9%
pow238.9%
Applied egg-rr32.8%
Taylor expanded in angle around 0 35.5%
if -5.0000000000000002e137 < (/.f64 angle 180) < 2e46Initial program 61.4%
unpow261.4%
unpow261.4%
difference-of-squares66.2%
Applied egg-rr66.2%
add-sqr-sqrt25.6%
sqrt-unprod31.6%
associate-*r/32.2%
associate-*r/32.3%
frac-times32.2%
metadata-eval32.2%
metadata-eval32.2%
frac-times32.3%
associate-*l/32.3%
associate-*l/32.3%
sqrt-unprod14.0%
add-sqr-sqrt21.5%
add-log-exp21.9%
*-commutative21.9%
Applied egg-rr22.2%
Taylor expanded in angle around inf 65.0%
associate-*r*82.7%
associate-*r*83.4%
*-commutative83.4%
*-commutative83.4%
+-commutative83.4%
Simplified83.4%
Taylor expanded in angle around 0 83.0%
associate-*r*83.0%
*-commutative83.0%
associate-*l*83.1%
Simplified83.1%
Final simplification67.5%
NOTE: a should be positive before calling this function
NOTE: b should be positive before calling this function
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* PI (* angle (+ a b)))))
(if (or (<= (/ angle 180.0) -2e-136) (not (<= (/ angle 180.0) 2e-95)))
(* (* 2.0 (* (+ a b) (- b a))) (sin (* (/ angle 180.0) PI)))
(* -0.011111111111111112 (- (* a t_0) (* b t_0))))))a = abs(a);
b = abs(b);
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle * (a + b));
double tmp;
if (((angle / 180.0) <= -2e-136) || !((angle / 180.0) <= 2e-95)) {
tmp = (2.0 * ((a + b) * (b - a))) * sin(((angle / 180.0) * ((double) M_PI)));
} else {
tmp = -0.011111111111111112 * ((a * t_0) - (b * t_0));
}
return tmp;
}
a = Math.abs(a);
b = Math.abs(b);
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (angle * (a + b));
double tmp;
if (((angle / 180.0) <= -2e-136) || !((angle / 180.0) <= 2e-95)) {
tmp = (2.0 * ((a + b) * (b - a))) * Math.sin(((angle / 180.0) * Math.PI));
} else {
tmp = -0.011111111111111112 * ((a * t_0) - (b * t_0));
}
return tmp;
}
a = abs(a) b = abs(b) def code(a, b, angle): t_0 = math.pi * (angle * (a + b)) tmp = 0 if ((angle / 180.0) <= -2e-136) or not ((angle / 180.0) <= 2e-95): tmp = (2.0 * ((a + b) * (b - a))) * math.sin(((angle / 180.0) * math.pi)) else: tmp = -0.011111111111111112 * ((a * t_0) - (b * t_0)) return tmp
a = abs(a) b = abs(b) function code(a, b, angle) t_0 = Float64(pi * Float64(angle * Float64(a + b))) tmp = 0.0 if ((Float64(angle / 180.0) <= -2e-136) || !(Float64(angle / 180.0) <= 2e-95)) tmp = Float64(Float64(2.0 * Float64(Float64(a + b) * Float64(b - a))) * sin(Float64(Float64(angle / 180.0) * pi))); else tmp = Float64(-0.011111111111111112 * Float64(Float64(a * t_0) - Float64(b * t_0))); end return tmp end
a = abs(a) b = abs(b) function tmp_2 = code(a, b, angle) t_0 = pi * (angle * (a + b)); tmp = 0.0; if (((angle / 180.0) <= -2e-136) || ~(((angle / 180.0) <= 2e-95))) tmp = (2.0 * ((a + b) * (b - a))) * sin(((angle / 180.0) * pi)); else tmp = -0.011111111111111112 * ((a * t_0) - (b * t_0)); end tmp_2 = tmp; end
NOTE: a should be positive before calling this function
NOTE: b should be positive before calling this function
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle * N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[N[(angle / 180.0), $MachinePrecision], -2e-136], N[Not[LessEqual[N[(angle / 180.0), $MachinePrecision], 2e-95]], $MachinePrecision]], N[(N[(2.0 * N[(N[(a + b), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(-0.011111111111111112 * N[(N[(a * t$95$0), $MachinePrecision] - N[(b * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
a = |a|\\
b = |b|\\
\\
\begin{array}{l}
t_0 := \pi \cdot \left(angle \cdot \left(a + b\right)\right)\\
\mathbf{if}\;\frac{angle}{180} \leq -2 \cdot 10^{-136} \lor \neg \left(\frac{angle}{180} \leq 2 \cdot 10^{-95}\right):\\
\;\;\;\;\left(2 \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\\
\mathbf{else}:\\
\;\;\;\;-0.011111111111111112 \cdot \left(a \cdot t_0 - b \cdot t_0\right)\\
\end{array}
\end{array}
if (/.f64 angle 180) < -2e-136 or 1.99999999999999998e-95 < (/.f64 angle 180) Initial program 43.1%
unpow243.1%
unpow243.1%
difference-of-squares48.9%
Applied egg-rr48.9%
add-sqr-sqrt53.2%
pow253.2%
Applied egg-rr50.9%
Taylor expanded in angle around 0 48.7%
if -2e-136 < (/.f64 angle 180) < 1.99999999999999998e-95Initial program 68.8%
Simplified68.8%
unpow268.8%
unpow268.8%
difference-of-squares69.1%
Applied egg-rr69.1%
Taylor expanded in angle around 0 69.1%
*-commutative69.1%
*-commutative69.1%
associate-*r*69.0%
+-commutative69.0%
Simplified69.0%
associate-*r*99.6%
sub-neg99.6%
distribute-lft-in99.6%
*-commutative99.6%
associate-*l*99.6%
*-commutative99.6%
associate-*l*99.5%
Applied egg-rr99.5%
Final simplification65.6%
NOTE: a should be positive before calling this function NOTE: b should be positive before calling this function (FPCore (a b angle) :precision binary64 (* (* 2.0 (* (+ a b) (- b a))) (sin (* (/ angle 180.0) PI))))
a = abs(a);
b = abs(b);
double code(double a, double b, double angle) {
return (2.0 * ((a + b) * (b - a))) * sin(((angle / 180.0) * ((double) M_PI)));
}
a = Math.abs(a);
b = Math.abs(b);
public static double code(double a, double b, double angle) {
return (2.0 * ((a + b) * (b - a))) * Math.sin(((angle / 180.0) * Math.PI));
}
a = abs(a) b = abs(b) def code(a, b, angle): return (2.0 * ((a + b) * (b - a))) * math.sin(((angle / 180.0) * math.pi))
a = abs(a) b = abs(b) function code(a, b, angle) return Float64(Float64(2.0 * Float64(Float64(a + b) * Float64(b - a))) * sin(Float64(Float64(angle / 180.0) * pi))) end
a = abs(a) b = abs(b) function tmp = code(a, b, angle) tmp = (2.0 * ((a + b) * (b - a))) * sin(((angle / 180.0) * pi)); end
NOTE: a should be positive before calling this function NOTE: b should be positive before calling this function code[a_, b_, angle_] := N[(N[(2.0 * N[(N[(a + b), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a = |a|\\
b = |b|\\
\\
\left(2 \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)
\end{array}
Initial program 51.6%
unpow251.6%
unpow251.6%
difference-of-squares55.6%
Applied egg-rr55.6%
add-sqr-sqrt58.5%
pow258.5%
Applied egg-rr56.9%
Taylor expanded in angle around 0 55.5%
Final simplification55.5%
NOTE: a should be positive before calling this function NOTE: b should be positive before calling this function (FPCore (a b angle) :precision binary64 (* -0.011111111111111112 (* angle (* PI (* (- a b) (+ a b))))))
a = abs(a);
b = abs(b);
double code(double a, double b, double angle) {
return -0.011111111111111112 * (angle * (((double) M_PI) * ((a - b) * (a + b))));
}
a = Math.abs(a);
b = Math.abs(b);
public static double code(double a, double b, double angle) {
return -0.011111111111111112 * (angle * (Math.PI * ((a - b) * (a + b))));
}
a = abs(a) b = abs(b) def code(a, b, angle): return -0.011111111111111112 * (angle * (math.pi * ((a - b) * (a + b))))
a = abs(a) b = abs(b) function code(a, b, angle) return Float64(-0.011111111111111112 * Float64(angle * Float64(pi * Float64(Float64(a - b) * Float64(a + b))))) end
a = abs(a) b = abs(b) function tmp = code(a, b, angle) tmp = -0.011111111111111112 * (angle * (pi * ((a - b) * (a + b)))); end
NOTE: a should be positive before calling this function NOTE: b should be positive before calling this function code[a_, b_, angle_] := N[(-0.011111111111111112 * N[(angle * N[(Pi * N[(N[(a - b), $MachinePrecision] * N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a = |a|\\
b = |b|\\
\\
-0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \left(\left(a - b\right) \cdot \left(a + b\right)\right)\right)\right)
\end{array}
Initial program 51.6%
Simplified50.6%
Taylor expanded in angle around 0 47.0%
unpow250.6%
unpow250.6%
difference-of-squares54.6%
Applied egg-rr50.6%
Final simplification50.6%
herbie shell --seed 2023306
(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)))))