
(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 13 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
(if (<= b 1.26e+183)
(*
(+ b a)
(*
(- b a)
(sin (* 2.0 (* (pow (sqrt PI) 2.0) (* 0.005555555555555556 angle))))))
(*
(+ b a)
(*
(- b a)
(sin (* 2.0 (* (* 0.005555555555555556 angle) (cbrt (pow PI 3.0)))))))))b = abs(b);
double code(double a, double b, double angle) {
double tmp;
if (b <= 1.26e+183) {
tmp = (b + a) * ((b - a) * sin((2.0 * (pow(sqrt(((double) M_PI)), 2.0) * (0.005555555555555556 * angle)))));
} else {
tmp = (b + a) * ((b - a) * sin((2.0 * ((0.005555555555555556 * angle) * cbrt(pow(((double) M_PI), 3.0))))));
}
return tmp;
}
b = Math.abs(b);
public static double code(double a, double b, double angle) {
double tmp;
if (b <= 1.26e+183) {
tmp = (b + a) * ((b - a) * Math.sin((2.0 * (Math.pow(Math.sqrt(Math.PI), 2.0) * (0.005555555555555556 * angle)))));
} else {
tmp = (b + a) * ((b - a) * Math.sin((2.0 * ((0.005555555555555556 * angle) * Math.cbrt(Math.pow(Math.PI, 3.0))))));
}
return tmp;
}
b = abs(b) function code(a, b, angle) tmp = 0.0 if (b <= 1.26e+183) tmp = Float64(Float64(b + a) * Float64(Float64(b - a) * sin(Float64(2.0 * Float64((sqrt(pi) ^ 2.0) * Float64(0.005555555555555556 * angle)))))); else tmp = Float64(Float64(b + a) * Float64(Float64(b - a) * sin(Float64(2.0 * Float64(Float64(0.005555555555555556 * angle) * cbrt((pi ^ 3.0))))))); end return tmp end
NOTE: b should be positive before calling this function code[a_, b_, angle_] := If[LessEqual[b, 1.26e+183], N[(N[(b + a), $MachinePrecision] * N[(N[(b - a), $MachinePrecision] * N[Sin[N[(2.0 * N[(N[Power[N[Sqrt[Pi], $MachinePrecision], 2.0], $MachinePrecision] * N[(0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b + a), $MachinePrecision] * N[(N[(b - a), $MachinePrecision] * N[Sin[N[(2.0 * N[(N[(0.005555555555555556 * angle), $MachinePrecision] * N[Power[N[Power[Pi, 3.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
b = |b|\\
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.26 \cdot 10^{+183}:\\
\;\;\;\;\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(2 \cdot \left({\left(\sqrt{\pi}\right)}^{2} \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(2 \cdot \left(\left(0.005555555555555556 \cdot angle\right) \cdot \sqrt[3]{{\pi}^{3}}\right)\right)\right)\\
\end{array}
\end{array}
if b < 1.26000000000000006e183Initial program 55.8%
*-commutative55.8%
associate-*l*55.8%
associate-*l*55.8%
unpow255.8%
unpow255.8%
difference-of-squares57.3%
Simplified57.3%
difference-of-squares55.8%
*-commutative55.8%
prod-diff43.2%
fma-neg43.2%
distribute-lft-in43.2%
Applied egg-rr43.8%
*-commutative43.8%
distribute-lft-in43.8%
*-commutative43.8%
Simplified66.4%
add-cbrt-cube67.0%
Applied egg-rr67.0%
add-cbrt-cube66.4%
add-sqr-sqrt67.9%
pow267.9%
Applied egg-rr67.9%
if 1.26000000000000006e183 < b Initial program 39.2%
*-commutative39.2%
associate-*l*39.2%
associate-*l*39.2%
unpow239.2%
unpow239.2%
difference-of-squares56.4%
Simplified56.4%
difference-of-squares39.2%
*-commutative39.2%
prod-diff39.2%
fma-neg39.2%
distribute-lft-in39.2%
Applied egg-rr49.5%
*-commutative49.5%
distribute-lft-in49.5%
*-commutative49.5%
Simplified75.9%
add-cbrt-cube86.2%
Applied egg-rr86.2%
expm1-log1p-u75.9%
expm1-udef86.2%
pow386.2%
Applied egg-rr86.2%
expm1-def75.9%
expm1-log1p86.2%
Simplified86.2%
Final simplification70.0%
NOTE: b should be positive before calling this function
(FPCore (a b angle)
:precision binary64
(if (<= b 7.5e+169)
(* (+ b a) (* (- b a) (sin (* 2.0 (* PI (/ 1.0 (/ 180.0 angle)))))))
(*
(+ b a)
(*
(- b a)
(sin (* 2.0 (* (* 0.005555555555555556 angle) (cbrt (pow PI 3.0)))))))))b = abs(b);
double code(double a, double b, double angle) {
double tmp;
if (b <= 7.5e+169) {
tmp = (b + a) * ((b - a) * sin((2.0 * (((double) M_PI) * (1.0 / (180.0 / angle))))));
} else {
tmp = (b + a) * ((b - a) * sin((2.0 * ((0.005555555555555556 * angle) * cbrt(pow(((double) M_PI), 3.0))))));
}
return tmp;
}
b = Math.abs(b);
public static double code(double a, double b, double angle) {
double tmp;
if (b <= 7.5e+169) {
tmp = (b + a) * ((b - a) * Math.sin((2.0 * (Math.PI * (1.0 / (180.0 / angle))))));
} else {
tmp = (b + a) * ((b - a) * Math.sin((2.0 * ((0.005555555555555556 * angle) * Math.cbrt(Math.pow(Math.PI, 3.0))))));
}
return tmp;
}
b = abs(b) function code(a, b, angle) tmp = 0.0 if (b <= 7.5e+169) tmp = Float64(Float64(b + a) * Float64(Float64(b - a) * sin(Float64(2.0 * Float64(pi * Float64(1.0 / Float64(180.0 / angle))))))); else tmp = Float64(Float64(b + a) * Float64(Float64(b - a) * sin(Float64(2.0 * Float64(Float64(0.005555555555555556 * angle) * cbrt((pi ^ 3.0))))))); end return tmp end
NOTE: b should be positive before calling this function code[a_, b_, angle_] := If[LessEqual[b, 7.5e+169], N[(N[(b + a), $MachinePrecision] * N[(N[(b - a), $MachinePrecision] * N[Sin[N[(2.0 * N[(Pi * N[(1.0 / N[(180.0 / angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b + a), $MachinePrecision] * N[(N[(b - a), $MachinePrecision] * N[Sin[N[(2.0 * N[(N[(0.005555555555555556 * angle), $MachinePrecision] * N[Power[N[Power[Pi, 3.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
b = |b|\\
\\
\begin{array}{l}
\mathbf{if}\;b \leq 7.5 \cdot 10^{+169}:\\
\;\;\;\;\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(2 \cdot \left(\pi \cdot \frac{1}{\frac{180}{angle}}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(2 \cdot \left(\left(0.005555555555555556 \cdot angle\right) \cdot \sqrt[3]{{\pi}^{3}}\right)\right)\right)\\
\end{array}
\end{array}
if b < 7.49999999999999992e169Initial program 55.8%
*-commutative55.8%
associate-*l*55.8%
associate-*l*55.8%
unpow255.8%
unpow255.8%
difference-of-squares57.3%
Simplified57.3%
difference-of-squares55.8%
*-commutative55.8%
prod-diff43.2%
fma-neg43.2%
distribute-lft-in43.2%
Applied egg-rr43.8%
*-commutative43.8%
distribute-lft-in43.8%
*-commutative43.8%
Simplified66.4%
*-commutative66.4%
metadata-eval66.4%
div-inv66.2%
clear-num66.3%
Applied egg-rr66.3%
if 7.49999999999999992e169 < b Initial program 39.2%
*-commutative39.2%
associate-*l*39.2%
associate-*l*39.2%
unpow239.2%
unpow239.2%
difference-of-squares56.4%
Simplified56.4%
difference-of-squares39.2%
*-commutative39.2%
prod-diff39.2%
fma-neg39.2%
distribute-lft-in39.2%
Applied egg-rr49.5%
*-commutative49.5%
distribute-lft-in49.5%
*-commutative49.5%
Simplified75.9%
add-cbrt-cube86.2%
Applied egg-rr86.2%
expm1-log1p-u75.9%
expm1-udef86.2%
pow386.2%
Applied egg-rr86.2%
expm1-def75.9%
expm1-log1p86.2%
Simplified86.2%
Final simplification68.5%
NOTE: b should be positive before calling this function (FPCore (a b angle) :precision binary64 (* (+ b a) (* (- b a) (sin (* 0.011111111111111112 (* PI angle))))))
b = abs(b);
double code(double a, double b, double angle) {
return (b + a) * ((b - a) * sin((0.011111111111111112 * (((double) M_PI) * angle))));
}
b = Math.abs(b);
public static double code(double a, double b, double angle) {
return (b + a) * ((b - a) * Math.sin((0.011111111111111112 * (Math.PI * angle))));
}
b = abs(b) def code(a, b, angle): return (b + a) * ((b - a) * math.sin((0.011111111111111112 * (math.pi * angle))))
b = abs(b) function code(a, b, angle) return Float64(Float64(b + a) * Float64(Float64(b - a) * sin(Float64(0.011111111111111112 * Float64(pi * angle))))) end
b = abs(b) function tmp = code(a, b, angle) tmp = (b + a) * ((b - a) * sin((0.011111111111111112 * (pi * angle)))); end
NOTE: b should be positive before calling this function code[a_, b_, angle_] := N[(N[(b + a), $MachinePrecision] * N[(N[(b - a), $MachinePrecision] * N[Sin[N[(0.011111111111111112 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b = |b|\\
\\
\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(0.011111111111111112 \cdot \left(\pi \cdot angle\right)\right)\right)
\end{array}
Initial program 54.0%
*-commutative54.0%
associate-*l*54.0%
associate-*l*54.0%
unpow254.0%
unpow254.0%
difference-of-squares57.2%
Simplified57.2%
difference-of-squares54.0%
*-commutative54.0%
prod-diff42.7%
fma-neg42.7%
distribute-lft-in42.7%
Applied egg-rr44.5%
*-commutative44.5%
distribute-lft-in44.5%
*-commutative44.5%
Simplified67.5%
Taylor expanded in angle around inf 69.1%
Final simplification69.1%
NOTE: b should be positive before calling this function (FPCore (a b angle) :precision binary64 (if (<= b 1.16e-139) (* (sin (* PI (* angle 0.011111111111111112))) (* a (- a))) (* (+ b a) (* (- b a) (* angle (* PI 0.011111111111111112))))))
b = abs(b);
double code(double a, double b, double angle) {
double tmp;
if (b <= 1.16e-139) {
tmp = sin((((double) M_PI) * (angle * 0.011111111111111112))) * (a * -a);
} else {
tmp = (b + a) * ((b - a) * (angle * (((double) M_PI) * 0.011111111111111112)));
}
return tmp;
}
b = Math.abs(b);
public static double code(double a, double b, double angle) {
double tmp;
if (b <= 1.16e-139) {
tmp = Math.sin((Math.PI * (angle * 0.011111111111111112))) * (a * -a);
} else {
tmp = (b + a) * ((b - a) * (angle * (Math.PI * 0.011111111111111112)));
}
return tmp;
}
b = abs(b) def code(a, b, angle): tmp = 0 if b <= 1.16e-139: tmp = math.sin((math.pi * (angle * 0.011111111111111112))) * (a * -a) else: tmp = (b + a) * ((b - a) * (angle * (math.pi * 0.011111111111111112))) return tmp
b = abs(b) function code(a, b, angle) tmp = 0.0 if (b <= 1.16e-139) tmp = Float64(sin(Float64(pi * Float64(angle * 0.011111111111111112))) * Float64(a * Float64(-a))); else tmp = Float64(Float64(b + a) * Float64(Float64(b - a) * Float64(angle * Float64(pi * 0.011111111111111112)))); end return tmp end
b = abs(b) function tmp_2 = code(a, b, angle) tmp = 0.0; if (b <= 1.16e-139) tmp = sin((pi * (angle * 0.011111111111111112))) * (a * -a); else tmp = (b + a) * ((b - a) * (angle * (pi * 0.011111111111111112))); end tmp_2 = tmp; end
NOTE: b should be positive before calling this function code[a_, b_, angle_] := If[LessEqual[b, 1.16e-139], N[(N[Sin[N[(Pi * N[(angle * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(a * (-a)), $MachinePrecision]), $MachinePrecision], N[(N[(b + a), $MachinePrecision] * N[(N[(b - a), $MachinePrecision] * N[(angle * N[(Pi * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
b = |b|\\
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.16 \cdot 10^{-139}:\\
\;\;\;\;\sin \left(\pi \cdot \left(angle \cdot 0.011111111111111112\right)\right) \cdot \left(a \cdot \left(-a\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \left(angle \cdot \left(\pi \cdot 0.011111111111111112\right)\right)\right)\\
\end{array}
\end{array}
if b < 1.15999999999999999e-139Initial program 55.7%
*-commutative55.7%
associate-*l*55.7%
associate-*l*55.7%
unpow255.7%
unpow255.7%
difference-of-squares57.1%
Simplified57.1%
associate-*l*67.5%
flip3-+20.8%
associate-*l/19.9%
associate-*l*19.9%
2-sin19.9%
div-inv20.2%
metadata-eval20.2%
fma-def20.2%
Applied egg-rr20.2%
associate-/l*18.5%
associate-*r*18.5%
*-commutative18.5%
Simplified18.5%
Taylor expanded in b around 0 44.4%
mul-1-neg44.4%
*-commutative44.4%
distribute-rgt-neg-in44.4%
associate-*r*43.8%
*-commutative43.8%
unpow243.8%
Simplified43.8%
if 1.15999999999999999e-139 < b Initial program 51.1%
*-commutative51.1%
associate-*l*51.1%
associate-*l*51.1%
unpow251.1%
unpow251.1%
difference-of-squares57.3%
Simplified57.3%
difference-of-squares51.1%
*-commutative51.1%
prod-diff40.6%
fma-neg40.6%
distribute-lft-in40.6%
Applied egg-rr43.7%
*-commutative43.7%
distribute-lft-in43.7%
*-commutative43.7%
Simplified67.0%
add-cbrt-cube66.2%
Applied egg-rr66.2%
Taylor expanded in angle around 0 65.5%
*-commutative65.5%
associate-*l*65.5%
Simplified65.5%
Final simplification52.0%
NOTE: b should be positive before calling this function (FPCore (a b angle) :precision binary64 (if (<= a 1.15e-139) (* (sin (* PI (* angle 0.011111111111111112))) (* b b)) (* (+ b a) (* (- b a) (* angle (* PI 0.011111111111111112))))))
b = abs(b);
double code(double a, double b, double angle) {
double tmp;
if (a <= 1.15e-139) {
tmp = sin((((double) M_PI) * (angle * 0.011111111111111112))) * (b * b);
} else {
tmp = (b + a) * ((b - a) * (angle * (((double) M_PI) * 0.011111111111111112)));
}
return tmp;
}
b = Math.abs(b);
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 1.15e-139) {
tmp = Math.sin((Math.PI * (angle * 0.011111111111111112))) * (b * b);
} else {
tmp = (b + a) * ((b - a) * (angle * (Math.PI * 0.011111111111111112)));
}
return tmp;
}
b = abs(b) def code(a, b, angle): tmp = 0 if a <= 1.15e-139: tmp = math.sin((math.pi * (angle * 0.011111111111111112))) * (b * b) else: tmp = (b + a) * ((b - a) * (angle * (math.pi * 0.011111111111111112))) return tmp
b = abs(b) function code(a, b, angle) tmp = 0.0 if (a <= 1.15e-139) tmp = Float64(sin(Float64(pi * Float64(angle * 0.011111111111111112))) * Float64(b * b)); else tmp = Float64(Float64(b + a) * Float64(Float64(b - a) * Float64(angle * Float64(pi * 0.011111111111111112)))); end return tmp end
b = abs(b) function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 1.15e-139) tmp = sin((pi * (angle * 0.011111111111111112))) * (b * b); else tmp = (b + a) * ((b - a) * (angle * (pi * 0.011111111111111112))); end tmp_2 = tmp; end
NOTE: b should be positive before calling this function code[a_, b_, angle_] := If[LessEqual[a, 1.15e-139], N[(N[Sin[N[(Pi * N[(angle * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision], N[(N[(b + a), $MachinePrecision] * N[(N[(b - a), $MachinePrecision] * N[(angle * N[(Pi * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
b = |b|\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.15 \cdot 10^{-139}:\\
\;\;\;\;\sin \left(\pi \cdot \left(angle \cdot 0.011111111111111112\right)\right) \cdot \left(b \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \left(angle \cdot \left(\pi \cdot 0.011111111111111112\right)\right)\right)\\
\end{array}
\end{array}
if a < 1.15000000000000006e-139Initial program 57.0%
*-commutative57.0%
associate-*l*57.0%
associate-*l*57.0%
unpow257.0%
unpow257.0%
difference-of-squares59.5%
Simplified59.5%
associate-*l*66.5%
flip3-+21.2%
associate-*l/18.7%
associate-*l*18.7%
2-sin18.7%
div-inv18.9%
metadata-eval18.9%
fma-def18.9%
Applied egg-rr18.8%
associate-/l*20.2%
associate-*r*20.2%
*-commutative20.2%
Simplified20.2%
Taylor expanded in b around inf 40.1%
*-commutative40.1%
associate-*r*40.5%
unpow240.5%
Simplified40.5%
if 1.15000000000000006e-139 < a Initial program 47.9%
*-commutative47.9%
associate-*l*47.9%
associate-*l*47.9%
unpow247.9%
unpow247.9%
difference-of-squares52.6%
Simplified52.6%
difference-of-squares47.9%
*-commutative47.9%
prod-diff33.5%
fma-neg33.5%
distribute-lft-in33.5%
Applied egg-rr37.0%
*-commutative37.0%
distribute-lft-in37.0%
*-commutative37.0%
Simplified67.8%
add-cbrt-cube71.8%
Applied egg-rr71.8%
Taylor expanded in angle around 0 58.6%
*-commutative58.6%
associate-*l*58.6%
Simplified58.6%
Final simplification46.6%
NOTE: b should be positive before calling this function (FPCore (a b angle) :precision binary64 (if (<= a 1.12e-135) (* 0.011111111111111112 (* angle (* PI (* b b)))) (* (+ b a) (* (- b a) (* 0.011111111111111112 (* PI angle))))))
b = abs(b);
double code(double a, double b, double angle) {
double tmp;
if (a <= 1.12e-135) {
tmp = 0.011111111111111112 * (angle * (((double) M_PI) * (b * b)));
} else {
tmp = (b + a) * ((b - a) * (0.011111111111111112 * (((double) M_PI) * angle)));
}
return tmp;
}
b = Math.abs(b);
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 1.12e-135) {
tmp = 0.011111111111111112 * (angle * (Math.PI * (b * b)));
} else {
tmp = (b + a) * ((b - a) * (0.011111111111111112 * (Math.PI * angle)));
}
return tmp;
}
b = abs(b) def code(a, b, angle): tmp = 0 if a <= 1.12e-135: tmp = 0.011111111111111112 * (angle * (math.pi * (b * b))) else: tmp = (b + a) * ((b - a) * (0.011111111111111112 * (math.pi * angle))) return tmp
b = abs(b) function code(a, b, angle) tmp = 0.0 if (a <= 1.12e-135) tmp = Float64(0.011111111111111112 * Float64(angle * Float64(pi * Float64(b * b)))); else tmp = Float64(Float64(b + a) * Float64(Float64(b - a) * Float64(0.011111111111111112 * Float64(pi * angle)))); end return tmp end
b = abs(b) function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 1.12e-135) tmp = 0.011111111111111112 * (angle * (pi * (b * b))); else tmp = (b + a) * ((b - a) * (0.011111111111111112 * (pi * angle))); end tmp_2 = tmp; end
NOTE: b should be positive before calling this function code[a_, b_, angle_] := If[LessEqual[a, 1.12e-135], N[(0.011111111111111112 * N[(angle * N[(Pi * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b + a), $MachinePrecision] * N[(N[(b - a), $MachinePrecision] * N[(0.011111111111111112 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
b = |b|\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.12 \cdot 10^{-135}:\\
\;\;\;\;0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \left(b \cdot b\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \left(0.011111111111111112 \cdot \left(\pi \cdot angle\right)\right)\right)\\
\end{array}
\end{array}
if a < 1.12e-135Initial program 57.0%
*-commutative57.0%
associate-*l*57.0%
associate-*l*57.0%
unpow257.0%
unpow257.0%
difference-of-squares59.5%
Simplified59.5%
Taylor expanded in angle around 0 59.7%
Taylor expanded in a around 0 39.6%
*-commutative39.6%
unpow239.6%
Simplified39.6%
if 1.12e-135 < a Initial program 47.9%
*-commutative47.9%
associate-*l*47.9%
associate-*l*47.9%
unpow247.9%
unpow247.9%
difference-of-squares52.6%
Simplified52.6%
difference-of-squares47.9%
*-commutative47.9%
prod-diff33.5%
fma-neg33.5%
distribute-lft-in33.5%
Applied egg-rr37.0%
*-commutative37.0%
distribute-lft-in37.0%
*-commutative37.0%
Simplified67.8%
Taylor expanded in angle around 0 58.6%
Final simplification46.0%
NOTE: b should be positive before calling this function (FPCore (a b angle) :precision binary64 (if (<= a 2.45e-138) (* 0.011111111111111112 (* angle (* PI (* b b)))) (* (+ b a) (* (- b a) (* angle (* PI 0.011111111111111112))))))
b = abs(b);
double code(double a, double b, double angle) {
double tmp;
if (a <= 2.45e-138) {
tmp = 0.011111111111111112 * (angle * (((double) M_PI) * (b * b)));
} else {
tmp = (b + a) * ((b - a) * (angle * (((double) M_PI) * 0.011111111111111112)));
}
return tmp;
}
b = Math.abs(b);
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 2.45e-138) {
tmp = 0.011111111111111112 * (angle * (Math.PI * (b * b)));
} else {
tmp = (b + a) * ((b - a) * (angle * (Math.PI * 0.011111111111111112)));
}
return tmp;
}
b = abs(b) def code(a, b, angle): tmp = 0 if a <= 2.45e-138: tmp = 0.011111111111111112 * (angle * (math.pi * (b * b))) else: tmp = (b + a) * ((b - a) * (angle * (math.pi * 0.011111111111111112))) return tmp
b = abs(b) function code(a, b, angle) tmp = 0.0 if (a <= 2.45e-138) tmp = Float64(0.011111111111111112 * Float64(angle * Float64(pi * Float64(b * b)))); else tmp = Float64(Float64(b + a) * Float64(Float64(b - a) * Float64(angle * Float64(pi * 0.011111111111111112)))); end return tmp end
b = abs(b) function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 2.45e-138) tmp = 0.011111111111111112 * (angle * (pi * (b * b))); else tmp = (b + a) * ((b - a) * (angle * (pi * 0.011111111111111112))); end tmp_2 = tmp; end
NOTE: b should be positive before calling this function code[a_, b_, angle_] := If[LessEqual[a, 2.45e-138], N[(0.011111111111111112 * N[(angle * N[(Pi * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b + a), $MachinePrecision] * N[(N[(b - a), $MachinePrecision] * N[(angle * N[(Pi * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
b = |b|\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq 2.45 \cdot 10^{-138}:\\
\;\;\;\;0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \left(b \cdot b\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \left(angle \cdot \left(\pi \cdot 0.011111111111111112\right)\right)\right)\\
\end{array}
\end{array}
if a < 2.45000000000000008e-138Initial program 57.0%
*-commutative57.0%
associate-*l*57.0%
associate-*l*57.0%
unpow257.0%
unpow257.0%
difference-of-squares59.5%
Simplified59.5%
Taylor expanded in angle around 0 59.7%
Taylor expanded in a around 0 39.6%
*-commutative39.6%
unpow239.6%
Simplified39.6%
if 2.45000000000000008e-138 < a Initial program 47.9%
*-commutative47.9%
associate-*l*47.9%
associate-*l*47.9%
unpow247.9%
unpow247.9%
difference-of-squares52.6%
Simplified52.6%
difference-of-squares47.9%
*-commutative47.9%
prod-diff33.5%
fma-neg33.5%
distribute-lft-in33.5%
Applied egg-rr37.0%
*-commutative37.0%
distribute-lft-in37.0%
*-commutative37.0%
Simplified67.8%
add-cbrt-cube71.8%
Applied egg-rr71.8%
Taylor expanded in angle around 0 58.6%
*-commutative58.6%
associate-*l*58.6%
Simplified58.6%
Final simplification46.0%
NOTE: b should be positive before calling this function (FPCore (a b angle) :precision binary64 (* 0.011111111111111112 (* angle (* PI (* (+ b a) (- b a))))))
b = abs(b);
double code(double a, double b, double angle) {
return 0.011111111111111112 * (angle * (((double) M_PI) * ((b + a) * (b - a))));
}
b = Math.abs(b);
public static double code(double a, double b, double angle) {
return 0.011111111111111112 * (angle * (Math.PI * ((b + a) * (b - a))));
}
b = abs(b) def code(a, b, angle): return 0.011111111111111112 * (angle * (math.pi * ((b + a) * (b - a))))
b = abs(b) function code(a, b, angle) return Float64(0.011111111111111112 * Float64(angle * Float64(pi * Float64(Float64(b + a) * Float64(b - a))))) end
b = abs(b) function tmp = code(a, b, angle) tmp = 0.011111111111111112 * (angle * (pi * ((b + a) * (b - a)))); end
NOTE: b should be positive before calling this function code[a_, b_, angle_] := N[(0.011111111111111112 * N[(angle * N[(Pi * N[(N[(b + a), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b = |b|\\
\\
0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)\right)\right)
\end{array}
Initial program 54.0%
*-commutative54.0%
associate-*l*54.0%
associate-*l*54.0%
unpow254.0%
unpow254.0%
difference-of-squares57.2%
Simplified57.2%
Taylor expanded in angle around 0 54.2%
Final simplification54.2%
NOTE: b should be positive before calling this function (FPCore (a b angle) :precision binary64 (if (<= a 3.9e+114) (* (* angle 0.011111111111111112) (* PI (* b b))) (* (* (* PI angle) (* a a)) (- 0.011111111111111112))))
b = abs(b);
double code(double a, double b, double angle) {
double tmp;
if (a <= 3.9e+114) {
tmp = (angle * 0.011111111111111112) * (((double) M_PI) * (b * b));
} else {
tmp = ((((double) M_PI) * angle) * (a * a)) * -0.011111111111111112;
}
return tmp;
}
b = Math.abs(b);
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 3.9e+114) {
tmp = (angle * 0.011111111111111112) * (Math.PI * (b * b));
} else {
tmp = ((Math.PI * angle) * (a * a)) * -0.011111111111111112;
}
return tmp;
}
b = abs(b) def code(a, b, angle): tmp = 0 if a <= 3.9e+114: tmp = (angle * 0.011111111111111112) * (math.pi * (b * b)) else: tmp = ((math.pi * angle) * (a * a)) * -0.011111111111111112 return tmp
b = abs(b) function code(a, b, angle) tmp = 0.0 if (a <= 3.9e+114) tmp = Float64(Float64(angle * 0.011111111111111112) * Float64(pi * Float64(b * b))); else tmp = Float64(Float64(Float64(pi * angle) * Float64(a * a)) * Float64(-0.011111111111111112)); end return tmp end
b = abs(b) function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 3.9e+114) tmp = (angle * 0.011111111111111112) * (pi * (b * b)); else tmp = ((pi * angle) * (a * a)) * -0.011111111111111112; end tmp_2 = tmp; end
NOTE: b should be positive before calling this function code[a_, b_, angle_] := If[LessEqual[a, 3.9e+114], N[(N[(angle * 0.011111111111111112), $MachinePrecision] * N[(Pi * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(Pi * angle), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision] * (-0.011111111111111112)), $MachinePrecision]]
\begin{array}{l}
b = |b|\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq 3.9 \cdot 10^{+114}:\\
\;\;\;\;\left(angle \cdot 0.011111111111111112\right) \cdot \left(\pi \cdot \left(b \cdot b\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\pi \cdot angle\right) \cdot \left(a \cdot a\right)\right) \cdot \left(-0.011111111111111112\right)\\
\end{array}
\end{array}
if a < 3.9000000000000001e114Initial program 55.4%
*-commutative55.4%
associate-*l*55.4%
associate-*l*55.4%
unpow255.4%
unpow255.4%
difference-of-squares57.3%
Simplified57.3%
Taylor expanded in angle around 0 56.2%
Taylor expanded in a around 0 38.7%
associate-*r*38.7%
*-commutative38.7%
unpow238.7%
Simplified38.7%
if 3.9000000000000001e114 < a Initial program 46.4%
*-commutative46.4%
associate-*l*46.4%
associate-*l*46.4%
unpow246.4%
unpow246.4%
difference-of-squares56.5%
Simplified56.5%
Taylor expanded in angle around 0 43.5%
Taylor expanded in a around inf 41.0%
mul-1-neg41.0%
*-commutative41.0%
distribute-rgt-neg-in41.0%
unpow241.0%
Simplified41.0%
Final simplification39.1%
NOTE: b should be positive before calling this function (FPCore (a b angle) :precision binary64 (if (<= a 3.6e+114) (* (* angle 0.011111111111111112) (* PI (* b b))) (* (* PI (* angle (* a a))) -0.011111111111111112)))
b = abs(b);
double code(double a, double b, double angle) {
double tmp;
if (a <= 3.6e+114) {
tmp = (angle * 0.011111111111111112) * (((double) M_PI) * (b * b));
} else {
tmp = (((double) M_PI) * (angle * (a * a))) * -0.011111111111111112;
}
return tmp;
}
b = Math.abs(b);
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 3.6e+114) {
tmp = (angle * 0.011111111111111112) * (Math.PI * (b * b));
} else {
tmp = (Math.PI * (angle * (a * a))) * -0.011111111111111112;
}
return tmp;
}
b = abs(b) def code(a, b, angle): tmp = 0 if a <= 3.6e+114: tmp = (angle * 0.011111111111111112) * (math.pi * (b * b)) else: tmp = (math.pi * (angle * (a * a))) * -0.011111111111111112 return tmp
b = abs(b) function code(a, b, angle) tmp = 0.0 if (a <= 3.6e+114) tmp = Float64(Float64(angle * 0.011111111111111112) * Float64(pi * Float64(b * b))); else tmp = Float64(Float64(pi * Float64(angle * Float64(a * a))) * -0.011111111111111112); end return tmp end
b = abs(b) function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 3.6e+114) tmp = (angle * 0.011111111111111112) * (pi * (b * b)); else tmp = (pi * (angle * (a * a))) * -0.011111111111111112; end tmp_2 = tmp; end
NOTE: b should be positive before calling this function code[a_, b_, angle_] := If[LessEqual[a, 3.6e+114], N[(N[(angle * 0.011111111111111112), $MachinePrecision] * N[(Pi * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * N[(angle * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.011111111111111112), $MachinePrecision]]
\begin{array}{l}
b = |b|\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq 3.6 \cdot 10^{+114}:\\
\;\;\;\;\left(angle \cdot 0.011111111111111112\right) \cdot \left(\pi \cdot \left(b \cdot b\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\pi \cdot \left(angle \cdot \left(a \cdot a\right)\right)\right) \cdot -0.011111111111111112\\
\end{array}
\end{array}
if a < 3.6000000000000001e114Initial program 55.4%
*-commutative55.4%
associate-*l*55.4%
associate-*l*55.4%
unpow255.4%
unpow255.4%
difference-of-squares57.3%
Simplified57.3%
Taylor expanded in angle around 0 56.2%
Taylor expanded in a around 0 38.7%
associate-*r*38.7%
*-commutative38.7%
unpow238.7%
Simplified38.7%
if 3.6000000000000001e114 < a Initial program 46.4%
*-commutative46.4%
associate-*l*46.4%
associate-*l*46.4%
unpow246.4%
unpow246.4%
difference-of-squares56.5%
Simplified56.5%
Taylor expanded in angle around 0 43.5%
Taylor expanded in a around inf 41.0%
*-commutative41.0%
associate-*r*41.0%
unpow241.0%
Simplified41.0%
Final simplification39.1%
NOTE: b should be positive before calling this function (FPCore (a b angle) :precision binary64 (* 0.011111111111111112 (* angle (* PI (* b b)))))
b = abs(b);
double code(double a, double b, double angle) {
return 0.011111111111111112 * (angle * (((double) M_PI) * (b * b)));
}
b = Math.abs(b);
public static double code(double a, double b, double angle) {
return 0.011111111111111112 * (angle * (Math.PI * (b * b)));
}
b = abs(b) def code(a, b, angle): return 0.011111111111111112 * (angle * (math.pi * (b * b)))
b = abs(b) function code(a, b, angle) return Float64(0.011111111111111112 * Float64(angle * Float64(pi * Float64(b * b)))) end
b = abs(b) function tmp = code(a, b, angle) tmp = 0.011111111111111112 * (angle * (pi * (b * b))); end
NOTE: b should be positive before calling this function code[a_, b_, angle_] := N[(0.011111111111111112 * N[(angle * N[(Pi * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b = |b|\\
\\
0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \left(b \cdot b\right)\right)\right)
\end{array}
Initial program 54.0%
*-commutative54.0%
associate-*l*54.0%
associate-*l*54.0%
unpow254.0%
unpow254.0%
difference-of-squares57.2%
Simplified57.2%
Taylor expanded in angle around 0 54.2%
Taylor expanded in a around 0 34.5%
*-commutative34.5%
unpow234.5%
Simplified34.5%
Final simplification34.5%
NOTE: b should be positive before calling this function (FPCore (a b angle) :precision binary64 (* (* angle 0.011111111111111112) (* PI (* b b))))
b = abs(b);
double code(double a, double b, double angle) {
return (angle * 0.011111111111111112) * (((double) M_PI) * (b * b));
}
b = Math.abs(b);
public static double code(double a, double b, double angle) {
return (angle * 0.011111111111111112) * (Math.PI * (b * b));
}
b = abs(b) def code(a, b, angle): return (angle * 0.011111111111111112) * (math.pi * (b * b))
b = abs(b) function code(a, b, angle) return Float64(Float64(angle * 0.011111111111111112) * Float64(pi * Float64(b * b))) end
b = abs(b) function tmp = code(a, b, angle) tmp = (angle * 0.011111111111111112) * (pi * (b * b)); end
NOTE: b should be positive before calling this function code[a_, b_, angle_] := N[(N[(angle * 0.011111111111111112), $MachinePrecision] * N[(Pi * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b = |b|\\
\\
\left(angle \cdot 0.011111111111111112\right) \cdot \left(\pi \cdot \left(b \cdot b\right)\right)
\end{array}
Initial program 54.0%
*-commutative54.0%
associate-*l*54.0%
associate-*l*54.0%
unpow254.0%
unpow254.0%
difference-of-squares57.2%
Simplified57.2%
Taylor expanded in angle around 0 54.2%
Taylor expanded in a around 0 34.5%
associate-*r*34.5%
*-commutative34.5%
unpow234.5%
Simplified34.5%
Final simplification34.5%
NOTE: b should be positive before calling this function (FPCore (a b angle) :precision binary64 0.0)
b = abs(b);
double code(double a, double b, double angle) {
return 0.0;
}
NOTE: b should be positive before calling this function
real(8) function code(a, b, angle)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
code = 0.0d0
end function
b = Math.abs(b);
public static double code(double a, double b, double angle) {
return 0.0;
}
b = abs(b) def code(a, b, angle): return 0.0
b = abs(b) function code(a, b, angle) return 0.0 end
b = abs(b) function tmp = code(a, b, angle) tmp = 0.0; end
NOTE: b should be positive before calling this function code[a_, b_, angle_] := 0.0
\begin{array}{l}
b = |b|\\
\\
0
\end{array}
Initial program 54.0%
*-commutative54.0%
associate-*l*54.0%
associate-*l*54.0%
unpow254.0%
unpow254.0%
difference-of-squares57.2%
Simplified57.2%
add-cube-cbrt57.8%
pow355.7%
div-inv55.4%
metadata-eval55.4%
Applied egg-rr55.4%
clear-num57.9%
un-div-inv57.4%
Applied egg-rr57.4%
Taylor expanded in angle around 0 15.7%
Final simplification15.7%
herbie shell --seed 2023283
(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)))))