
(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 10 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}
b_m = (fabs.f64 b)
(FPCore (a b_m angle)
:precision binary64
(if (<= b_m 1e+171)
(*
(cos (* angle (/ PI -180.0)))
(*
2.0
(* (* (sin (* (* angle PI) -0.005555555555555556)) (+ b_m a)) (- a b_m))))
(* (- b_m a) (* (+ b_m a) (* (* angle PI) 0.011111111111111112)))))b_m = fabs(b);
double code(double a, double b_m, double angle) {
double tmp;
if (b_m <= 1e+171) {
tmp = cos((angle * (((double) M_PI) / -180.0))) * (2.0 * ((sin(((angle * ((double) M_PI)) * -0.005555555555555556)) * (b_m + a)) * (a - b_m)));
} else {
tmp = (b_m - a) * ((b_m + a) * ((angle * ((double) M_PI)) * 0.011111111111111112));
}
return tmp;
}
b_m = Math.abs(b);
public static double code(double a, double b_m, double angle) {
double tmp;
if (b_m <= 1e+171) {
tmp = Math.cos((angle * (Math.PI / -180.0))) * (2.0 * ((Math.sin(((angle * Math.PI) * -0.005555555555555556)) * (b_m + a)) * (a - b_m)));
} else {
tmp = (b_m - a) * ((b_m + a) * ((angle * Math.PI) * 0.011111111111111112));
}
return tmp;
}
b_m = math.fabs(b) def code(a, b_m, angle): tmp = 0 if b_m <= 1e+171: tmp = math.cos((angle * (math.pi / -180.0))) * (2.0 * ((math.sin(((angle * math.pi) * -0.005555555555555556)) * (b_m + a)) * (a - b_m))) else: tmp = (b_m - a) * ((b_m + a) * ((angle * math.pi) * 0.011111111111111112)) return tmp
b_m = abs(b) function code(a, b_m, angle) tmp = 0.0 if (b_m <= 1e+171) tmp = Float64(cos(Float64(angle * Float64(pi / -180.0))) * Float64(2.0 * Float64(Float64(sin(Float64(Float64(angle * pi) * -0.005555555555555556)) * Float64(b_m + a)) * Float64(a - b_m)))); else tmp = Float64(Float64(b_m - a) * Float64(Float64(b_m + a) * Float64(Float64(angle * pi) * 0.011111111111111112))); end return tmp end
b_m = abs(b); function tmp_2 = code(a, b_m, angle) tmp = 0.0; if (b_m <= 1e+171) tmp = cos((angle * (pi / -180.0))) * (2.0 * ((sin(((angle * pi) * -0.005555555555555556)) * (b_m + a)) * (a - b_m))); else tmp = (b_m - a) * ((b_m + a) * ((angle * pi) * 0.011111111111111112)); end tmp_2 = tmp; end
b_m = N[Abs[b], $MachinePrecision] code[a_, b$95$m_, angle_] := If[LessEqual[b$95$m, 1e+171], N[(N[Cos[N[(angle * N[(Pi / -180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(2.0 * N[(N[(N[Sin[N[(N[(angle * Pi), $MachinePrecision] * -0.005555555555555556), $MachinePrecision]], $MachinePrecision] * N[(b$95$m + a), $MachinePrecision]), $MachinePrecision] * N[(a - b$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b$95$m - a), $MachinePrecision] * N[(N[(b$95$m + a), $MachinePrecision] * N[(N[(angle * Pi), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
b_m = \left|b\right|
\\
\begin{array}{l}
\mathbf{if}\;b\_m \leq 10^{+171}:\\
\;\;\;\;\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(2 \cdot \left(\left(\sin \left(\left(angle \cdot \pi\right) \cdot -0.005555555555555556\right) \cdot \left(b\_m + a\right)\right) \cdot \left(a - b\_m\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(b\_m - a\right) \cdot \left(\left(b\_m + a\right) \cdot \left(\left(angle \cdot \pi\right) \cdot 0.011111111111111112\right)\right)\\
\end{array}
\end{array}
if b < 9.99999999999999954e170Initial program 61.9%
Simplified62.7%
unpow262.7%
unpow262.7%
difference-of-squares66.2%
Applied egg-rr66.2%
add-cbrt-cube64.1%
pow364.1%
Applied egg-rr64.1%
add-exp-log37.4%
rem-cbrt-cube39.2%
div-inv39.2%
metadata-eval39.2%
+-commutative39.2%
Applied egg-rr39.2%
associate-*r*41.4%
add-exp-log70.8%
associate-*r*70.6%
metadata-eval70.6%
div-inv70.6%
+-commutative70.6%
div-inv70.6%
metadata-eval70.6%
Applied egg-rr70.6%
if 9.99999999999999954e170 < b Initial program 44.9%
Taylor expanded in angle around 0 34.9%
unpow234.9%
unpow234.9%
difference-of-squares52.0%
Applied egg-rr52.0%
expm1-log1p-u27.8%
associate-*r*27.8%
associate-*r*27.8%
Applied egg-rr27.8%
Taylor expanded in angle around 0 52.0%
associate-*r*52.0%
associate-*r*52.0%
associate-*l*79.7%
*-commutative79.7%
associate-*r*79.6%
associate-*r*79.9%
Simplified79.9%
Final simplification71.7%
b_m = (fabs.f64 b)
(FPCore (a b_m angle)
:precision binary64
(if (<= (/ angle 180.0) 5e+81)
(* (- b_m a) (* (* angle 0.011111111111111112) (* PI (+ b_m a))))
(if (<= (/ angle 180.0) 5e+199)
(* 2.0 (* (sin (* angle (/ PI -180.0))) (* (+ b_m a) (- a b_m))))
(+
(+ 1.0 (* (* angle 0.011111111111111112) (* PI (* (+ b_m a) (- b_m a)))))
-1.0))))b_m = fabs(b);
double code(double a, double b_m, double angle) {
double tmp;
if ((angle / 180.0) <= 5e+81) {
tmp = (b_m - a) * ((angle * 0.011111111111111112) * (((double) M_PI) * (b_m + a)));
} else if ((angle / 180.0) <= 5e+199) {
tmp = 2.0 * (sin((angle * (((double) M_PI) / -180.0))) * ((b_m + a) * (a - b_m)));
} else {
tmp = (1.0 + ((angle * 0.011111111111111112) * (((double) M_PI) * ((b_m + a) * (b_m - a))))) + -1.0;
}
return tmp;
}
b_m = Math.abs(b);
public static double code(double a, double b_m, double angle) {
double tmp;
if ((angle / 180.0) <= 5e+81) {
tmp = (b_m - a) * ((angle * 0.011111111111111112) * (Math.PI * (b_m + a)));
} else if ((angle / 180.0) <= 5e+199) {
tmp = 2.0 * (Math.sin((angle * (Math.PI / -180.0))) * ((b_m + a) * (a - b_m)));
} else {
tmp = (1.0 + ((angle * 0.011111111111111112) * (Math.PI * ((b_m + a) * (b_m - a))))) + -1.0;
}
return tmp;
}
b_m = math.fabs(b) def code(a, b_m, angle): tmp = 0 if (angle / 180.0) <= 5e+81: tmp = (b_m - a) * ((angle * 0.011111111111111112) * (math.pi * (b_m + a))) elif (angle / 180.0) <= 5e+199: tmp = 2.0 * (math.sin((angle * (math.pi / -180.0))) * ((b_m + a) * (a - b_m))) else: tmp = (1.0 + ((angle * 0.011111111111111112) * (math.pi * ((b_m + a) * (b_m - a))))) + -1.0 return tmp
b_m = abs(b) function code(a, b_m, angle) tmp = 0.0 if (Float64(angle / 180.0) <= 5e+81) tmp = Float64(Float64(b_m - a) * Float64(Float64(angle * 0.011111111111111112) * Float64(pi * Float64(b_m + a)))); elseif (Float64(angle / 180.0) <= 5e+199) tmp = Float64(2.0 * Float64(sin(Float64(angle * Float64(pi / -180.0))) * Float64(Float64(b_m + a) * Float64(a - b_m)))); else tmp = Float64(Float64(1.0 + Float64(Float64(angle * 0.011111111111111112) * Float64(pi * Float64(Float64(b_m + a) * Float64(b_m - a))))) + -1.0); end return tmp end
b_m = abs(b); function tmp_2 = code(a, b_m, angle) tmp = 0.0; if ((angle / 180.0) <= 5e+81) tmp = (b_m - a) * ((angle * 0.011111111111111112) * (pi * (b_m + a))); elseif ((angle / 180.0) <= 5e+199) tmp = 2.0 * (sin((angle * (pi / -180.0))) * ((b_m + a) * (a - b_m))); else tmp = (1.0 + ((angle * 0.011111111111111112) * (pi * ((b_m + a) * (b_m - a))))) + -1.0; end tmp_2 = tmp; end
b_m = N[Abs[b], $MachinePrecision] code[a_, b$95$m_, angle_] := If[LessEqual[N[(angle / 180.0), $MachinePrecision], 5e+81], N[(N[(b$95$m - a), $MachinePrecision] * N[(N[(angle * 0.011111111111111112), $MachinePrecision] * N[(Pi * N[(b$95$m + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle / 180.0), $MachinePrecision], 5e+199], N[(2.0 * N[(N[Sin[N[(angle * N[(Pi / -180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(b$95$m + a), $MachinePrecision] * N[(a - b$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(angle * 0.011111111111111112), $MachinePrecision] * N[(Pi * N[(N[(b$95$m + a), $MachinePrecision] * N[(b$95$m - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]]]
\begin{array}{l}
b_m = \left|b\right|
\\
\begin{array}{l}
\mathbf{if}\;\frac{angle}{180} \leq 5 \cdot 10^{+81}:\\
\;\;\;\;\left(b\_m - a\right) \cdot \left(\left(angle \cdot 0.011111111111111112\right) \cdot \left(\pi \cdot \left(b\_m + a\right)\right)\right)\\
\mathbf{elif}\;\frac{angle}{180} \leq 5 \cdot 10^{+199}:\\
\;\;\;\;2 \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\left(b\_m + a\right) \cdot \left(a - b\_m\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(angle \cdot 0.011111111111111112\right) \cdot \left(\pi \cdot \left(\left(b\_m + a\right) \cdot \left(b\_m - a\right)\right)\right)\right) + -1\\
\end{array}
\end{array}
if (/.f64 angle #s(literal 180 binary64)) < 4.9999999999999998e81Initial program 64.9%
Taylor expanded in angle around 0 62.1%
unpow262.1%
unpow262.1%
difference-of-squares67.4%
Applied egg-rr67.4%
expm1-log1p-u49.5%
associate-*r*49.4%
associate-*r*49.5%
Applied egg-rr49.5%
expm1-log1p-u67.4%
associate-*r*75.3%
+-commutative75.3%
Applied egg-rr75.3%
if 4.9999999999999998e81 < (/.f64 angle #s(literal 180 binary64)) < 4.9999999999999998e199Initial program 38.4%
Simplified33.3%
unpow233.3%
unpow233.3%
difference-of-squares33.3%
Applied egg-rr33.3%
Taylor expanded in angle around 0 49.6%
if 4.9999999999999998e199 < (/.f64 angle #s(literal 180 binary64)) Initial program 35.1%
Taylor expanded in angle around 0 37.2%
unpow237.2%
unpow237.2%
difference-of-squares45.2%
Applied egg-rr45.2%
expm1-log1p-u28.8%
associate-*r*28.8%
associate-*r*28.8%
Applied egg-rr28.8%
expm1-undefine29.0%
log1p-undefine29.0%
rem-exp-log45.4%
associate-*l*45.4%
+-commutative45.4%
Applied egg-rr45.4%
Final simplification70.3%
b_m = (fabs.f64 b)
(FPCore (a b_m angle)
:precision binary64
(if (<= angle 1e+34)
(* (- b_m a) (* (* angle 0.011111111111111112) (* PI (+ b_m a))))
(+
(+ 1.0 (* (* angle 0.011111111111111112) (* PI (* (+ b_m a) (- b_m a)))))
-1.0)))b_m = fabs(b);
double code(double a, double b_m, double angle) {
double tmp;
if (angle <= 1e+34) {
tmp = (b_m - a) * ((angle * 0.011111111111111112) * (((double) M_PI) * (b_m + a)));
} else {
tmp = (1.0 + ((angle * 0.011111111111111112) * (((double) M_PI) * ((b_m + a) * (b_m - a))))) + -1.0;
}
return tmp;
}
b_m = Math.abs(b);
public static double code(double a, double b_m, double angle) {
double tmp;
if (angle <= 1e+34) {
tmp = (b_m - a) * ((angle * 0.011111111111111112) * (Math.PI * (b_m + a)));
} else {
tmp = (1.0 + ((angle * 0.011111111111111112) * (Math.PI * ((b_m + a) * (b_m - a))))) + -1.0;
}
return tmp;
}
b_m = math.fabs(b) def code(a, b_m, angle): tmp = 0 if angle <= 1e+34: tmp = (b_m - a) * ((angle * 0.011111111111111112) * (math.pi * (b_m + a))) else: tmp = (1.0 + ((angle * 0.011111111111111112) * (math.pi * ((b_m + a) * (b_m - a))))) + -1.0 return tmp
b_m = abs(b) function code(a, b_m, angle) tmp = 0.0 if (angle <= 1e+34) tmp = Float64(Float64(b_m - a) * Float64(Float64(angle * 0.011111111111111112) * Float64(pi * Float64(b_m + a)))); else tmp = Float64(Float64(1.0 + Float64(Float64(angle * 0.011111111111111112) * Float64(pi * Float64(Float64(b_m + a) * Float64(b_m - a))))) + -1.0); end return tmp end
b_m = abs(b); function tmp_2 = code(a, b_m, angle) tmp = 0.0; if (angle <= 1e+34) tmp = (b_m - a) * ((angle * 0.011111111111111112) * (pi * (b_m + a))); else tmp = (1.0 + ((angle * 0.011111111111111112) * (pi * ((b_m + a) * (b_m - a))))) + -1.0; end tmp_2 = tmp; end
b_m = N[Abs[b], $MachinePrecision] code[a_, b$95$m_, angle_] := If[LessEqual[angle, 1e+34], N[(N[(b$95$m - a), $MachinePrecision] * N[(N[(angle * 0.011111111111111112), $MachinePrecision] * N[(Pi * N[(b$95$m + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(angle * 0.011111111111111112), $MachinePrecision] * N[(Pi * N[(N[(b$95$m + a), $MachinePrecision] * N[(b$95$m - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
b_m = \left|b\right|
\\
\begin{array}{l}
\mathbf{if}\;angle \leq 10^{+34}:\\
\;\;\;\;\left(b\_m - a\right) \cdot \left(\left(angle \cdot 0.011111111111111112\right) \cdot \left(\pi \cdot \left(b\_m + a\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(angle \cdot 0.011111111111111112\right) \cdot \left(\pi \cdot \left(\left(b\_m + a\right) \cdot \left(b\_m - a\right)\right)\right)\right) + -1\\
\end{array}
\end{array}
if angle < 9.99999999999999946e33Initial program 67.1%
Taylor expanded in angle around 0 63.3%
unpow263.3%
unpow263.3%
difference-of-squares67.8%
Applied egg-rr67.8%
expm1-log1p-u51.1%
associate-*r*51.1%
associate-*r*51.1%
Applied egg-rr51.1%
expm1-log1p-u67.8%
associate-*r*76.1%
+-commutative76.1%
Applied egg-rr76.1%
if 9.99999999999999946e33 < angle Initial program 33.2%
Taylor expanded in angle around 0 35.0%
unpow235.0%
unpow235.0%
difference-of-squares42.4%
Applied egg-rr42.4%
expm1-log1p-u23.1%
associate-*r*23.1%
associate-*r*23.1%
Applied egg-rr23.1%
expm1-undefine24.4%
log1p-undefine24.4%
rem-exp-log43.6%
associate-*l*43.6%
+-commutative43.6%
Applied egg-rr43.6%
Final simplification69.2%
b_m = (fabs.f64 b) (FPCore (a b_m angle) :precision binary64 (if (<= angle 2e-53) (* (- b_m a) (* (* angle 0.011111111111111112) (* PI (+ b_m a)))) (* 0.011111111111111112 (* angle (* PI (* (+ b_m a) (- b_m a)))))))
b_m = fabs(b);
double code(double a, double b_m, double angle) {
double tmp;
if (angle <= 2e-53) {
tmp = (b_m - a) * ((angle * 0.011111111111111112) * (((double) M_PI) * (b_m + a)));
} else {
tmp = 0.011111111111111112 * (angle * (((double) M_PI) * ((b_m + a) * (b_m - a))));
}
return tmp;
}
b_m = Math.abs(b);
public static double code(double a, double b_m, double angle) {
double tmp;
if (angle <= 2e-53) {
tmp = (b_m - a) * ((angle * 0.011111111111111112) * (Math.PI * (b_m + a)));
} else {
tmp = 0.011111111111111112 * (angle * (Math.PI * ((b_m + a) * (b_m - a))));
}
return tmp;
}
b_m = math.fabs(b) def code(a, b_m, angle): tmp = 0 if angle <= 2e-53: tmp = (b_m - a) * ((angle * 0.011111111111111112) * (math.pi * (b_m + a))) else: tmp = 0.011111111111111112 * (angle * (math.pi * ((b_m + a) * (b_m - a)))) return tmp
b_m = abs(b) function code(a, b_m, angle) tmp = 0.0 if (angle <= 2e-53) tmp = Float64(Float64(b_m - a) * Float64(Float64(angle * 0.011111111111111112) * Float64(pi * Float64(b_m + a)))); else tmp = Float64(0.011111111111111112 * Float64(angle * Float64(pi * Float64(Float64(b_m + a) * Float64(b_m - a))))); end return tmp end
b_m = abs(b); function tmp_2 = code(a, b_m, angle) tmp = 0.0; if (angle <= 2e-53) tmp = (b_m - a) * ((angle * 0.011111111111111112) * (pi * (b_m + a))); else tmp = 0.011111111111111112 * (angle * (pi * ((b_m + a) * (b_m - a)))); end tmp_2 = tmp; end
b_m = N[Abs[b], $MachinePrecision] code[a_, b$95$m_, angle_] := If[LessEqual[angle, 2e-53], N[(N[(b$95$m - a), $MachinePrecision] * N[(N[(angle * 0.011111111111111112), $MachinePrecision] * N[(Pi * N[(b$95$m + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.011111111111111112 * N[(angle * N[(Pi * N[(N[(b$95$m + a), $MachinePrecision] * N[(b$95$m - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
b_m = \left|b\right|
\\
\begin{array}{l}
\mathbf{if}\;angle \leq 2 \cdot 10^{-53}:\\
\;\;\;\;\left(b\_m - a\right) \cdot \left(\left(angle \cdot 0.011111111111111112\right) \cdot \left(\pi \cdot \left(b\_m + a\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \left(\left(b\_m + a\right) \cdot \left(b\_m - a\right)\right)\right)\right)\\
\end{array}
\end{array}
if angle < 2.00000000000000006e-53Initial program 67.0%
Taylor expanded in angle around 0 65.0%
unpow265.0%
unpow265.0%
difference-of-squares67.9%
Applied egg-rr67.9%
expm1-log1p-u52.0%
associate-*r*52.0%
associate-*r*52.0%
Applied egg-rr52.0%
expm1-log1p-u67.9%
associate-*r*77.1%
+-commutative77.1%
Applied egg-rr77.1%
if 2.00000000000000006e-53 < angle Initial program 43.0%
Taylor expanded in angle around 0 38.7%
unpow238.7%
unpow238.7%
difference-of-squares49.4%
Applied egg-rr49.4%
Final simplification68.9%
b_m = (fabs.f64 b) (FPCore (a b_m angle) :precision binary64 (if (<= a 2.85e+138) (* 0.011111111111111112 (* angle (* PI (* (+ b_m a) (- b_m a))))) (* (* a 0.011111111111111112) (* (* angle PI) (- b_m a)))))
b_m = fabs(b);
double code(double a, double b_m, double angle) {
double tmp;
if (a <= 2.85e+138) {
tmp = 0.011111111111111112 * (angle * (((double) M_PI) * ((b_m + a) * (b_m - a))));
} else {
tmp = (a * 0.011111111111111112) * ((angle * ((double) M_PI)) * (b_m - a));
}
return tmp;
}
b_m = Math.abs(b);
public static double code(double a, double b_m, double angle) {
double tmp;
if (a <= 2.85e+138) {
tmp = 0.011111111111111112 * (angle * (Math.PI * ((b_m + a) * (b_m - a))));
} else {
tmp = (a * 0.011111111111111112) * ((angle * Math.PI) * (b_m - a));
}
return tmp;
}
b_m = math.fabs(b) def code(a, b_m, angle): tmp = 0 if a <= 2.85e+138: tmp = 0.011111111111111112 * (angle * (math.pi * ((b_m + a) * (b_m - a)))) else: tmp = (a * 0.011111111111111112) * ((angle * math.pi) * (b_m - a)) return tmp
b_m = abs(b) function code(a, b_m, angle) tmp = 0.0 if (a <= 2.85e+138) tmp = Float64(0.011111111111111112 * Float64(angle * Float64(pi * Float64(Float64(b_m + a) * Float64(b_m - a))))); else tmp = Float64(Float64(a * 0.011111111111111112) * Float64(Float64(angle * pi) * Float64(b_m - a))); end return tmp end
b_m = abs(b); function tmp_2 = code(a, b_m, angle) tmp = 0.0; if (a <= 2.85e+138) tmp = 0.011111111111111112 * (angle * (pi * ((b_m + a) * (b_m - a)))); else tmp = (a * 0.011111111111111112) * ((angle * pi) * (b_m - a)); end tmp_2 = tmp; end
b_m = N[Abs[b], $MachinePrecision] code[a_, b$95$m_, angle_] := If[LessEqual[a, 2.85e+138], N[(0.011111111111111112 * N[(angle * N[(Pi * N[(N[(b$95$m + a), $MachinePrecision] * N[(b$95$m - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * 0.011111111111111112), $MachinePrecision] * N[(N[(angle * Pi), $MachinePrecision] * N[(b$95$m - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
b_m = \left|b\right|
\\
\begin{array}{l}
\mathbf{if}\;a \leq 2.85 \cdot 10^{+138}:\\
\;\;\;\;0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \left(\left(b\_m + a\right) \cdot \left(b\_m - a\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot 0.011111111111111112\right) \cdot \left(\left(angle \cdot \pi\right) \cdot \left(b\_m - a\right)\right)\\
\end{array}
\end{array}
if a < 2.84999999999999993e138Initial program 63.9%
Taylor expanded in angle around 0 60.3%
unpow260.3%
unpow260.3%
difference-of-squares63.0%
Applied egg-rr63.0%
if 2.84999999999999993e138 < a Initial program 35.2%
Taylor expanded in angle around 0 38.3%
unpow238.3%
unpow238.3%
difference-of-squares58.7%
Applied egg-rr58.7%
Taylor expanded in b around 0 47.2%
Taylor expanded in angle around 0 56.9%
associate-*r*56.9%
associate-*r*57.0%
Simplified57.0%
Final simplification62.2%
b_m = (fabs.f64 b) (FPCore (a b_m angle) :precision binary64 (if (<= b_m 1.2e-37) (* 0.011111111111111112 (* (- b_m a) (* angle (* PI a)))) (* 0.011111111111111112 (* angle (* PI (* b_m (- b_m a)))))))
b_m = fabs(b);
double code(double a, double b_m, double angle) {
double tmp;
if (b_m <= 1.2e-37) {
tmp = 0.011111111111111112 * ((b_m - a) * (angle * (((double) M_PI) * a)));
} else {
tmp = 0.011111111111111112 * (angle * (((double) M_PI) * (b_m * (b_m - a))));
}
return tmp;
}
b_m = Math.abs(b);
public static double code(double a, double b_m, double angle) {
double tmp;
if (b_m <= 1.2e-37) {
tmp = 0.011111111111111112 * ((b_m - a) * (angle * (Math.PI * a)));
} else {
tmp = 0.011111111111111112 * (angle * (Math.PI * (b_m * (b_m - a))));
}
return tmp;
}
b_m = math.fabs(b) def code(a, b_m, angle): tmp = 0 if b_m <= 1.2e-37: tmp = 0.011111111111111112 * ((b_m - a) * (angle * (math.pi * a))) else: tmp = 0.011111111111111112 * (angle * (math.pi * (b_m * (b_m - a)))) return tmp
b_m = abs(b) function code(a, b_m, angle) tmp = 0.0 if (b_m <= 1.2e-37) tmp = Float64(0.011111111111111112 * Float64(Float64(b_m - a) * Float64(angle * Float64(pi * a)))); else tmp = Float64(0.011111111111111112 * Float64(angle * Float64(pi * Float64(b_m * Float64(b_m - a))))); end return tmp end
b_m = abs(b); function tmp_2 = code(a, b_m, angle) tmp = 0.0; if (b_m <= 1.2e-37) tmp = 0.011111111111111112 * ((b_m - a) * (angle * (pi * a))); else tmp = 0.011111111111111112 * (angle * (pi * (b_m * (b_m - a)))); end tmp_2 = tmp; end
b_m = N[Abs[b], $MachinePrecision] code[a_, b$95$m_, angle_] := If[LessEqual[b$95$m, 1.2e-37], N[(0.011111111111111112 * N[(N[(b$95$m - a), $MachinePrecision] * N[(angle * N[(Pi * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.011111111111111112 * N[(angle * N[(Pi * N[(b$95$m * N[(b$95$m - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
b_m = \left|b\right|
\\
\begin{array}{l}
\mathbf{if}\;b\_m \leq 1.2 \cdot 10^{-37}:\\
\;\;\;\;0.011111111111111112 \cdot \left(\left(b\_m - a\right) \cdot \left(angle \cdot \left(\pi \cdot a\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \left(b\_m \cdot \left(b\_m - a\right)\right)\right)\right)\\
\end{array}
\end{array}
if b < 1.19999999999999995e-37Initial program 61.7%
Taylor expanded in angle around 0 61.0%
unpow261.0%
unpow261.0%
difference-of-squares65.2%
Applied egg-rr65.2%
Taylor expanded in b around 0 48.1%
pow148.1%
associate-*r*48.1%
associate-*r*48.1%
Applied egg-rr48.1%
unpow148.1%
associate-*l*48.1%
associate-*r*47.9%
*-commutative47.9%
Simplified47.9%
if 1.19999999999999995e-37 < b Initial program 54.8%
Taylor expanded in angle around 0 46.7%
unpow246.7%
unpow246.7%
difference-of-squares54.5%
Applied egg-rr54.5%
Taylor expanded in b around inf 47.6%
Final simplification47.8%
b_m = (fabs.f64 b) (FPCore (a b_m angle) :precision binary64 (if (<= b_m 1.1e-38) (* 0.011111111111111112 (* angle (* PI (* a (- b_m a))))) (* 0.011111111111111112 (* angle (* PI (* b_m (- b_m a)))))))
b_m = fabs(b);
double code(double a, double b_m, double angle) {
double tmp;
if (b_m <= 1.1e-38) {
tmp = 0.011111111111111112 * (angle * (((double) M_PI) * (a * (b_m - a))));
} else {
tmp = 0.011111111111111112 * (angle * (((double) M_PI) * (b_m * (b_m - a))));
}
return tmp;
}
b_m = Math.abs(b);
public static double code(double a, double b_m, double angle) {
double tmp;
if (b_m <= 1.1e-38) {
tmp = 0.011111111111111112 * (angle * (Math.PI * (a * (b_m - a))));
} else {
tmp = 0.011111111111111112 * (angle * (Math.PI * (b_m * (b_m - a))));
}
return tmp;
}
b_m = math.fabs(b) def code(a, b_m, angle): tmp = 0 if b_m <= 1.1e-38: tmp = 0.011111111111111112 * (angle * (math.pi * (a * (b_m - a)))) else: tmp = 0.011111111111111112 * (angle * (math.pi * (b_m * (b_m - a)))) return tmp
b_m = abs(b) function code(a, b_m, angle) tmp = 0.0 if (b_m <= 1.1e-38) tmp = Float64(0.011111111111111112 * Float64(angle * Float64(pi * Float64(a * Float64(b_m - a))))); else tmp = Float64(0.011111111111111112 * Float64(angle * Float64(pi * Float64(b_m * Float64(b_m - a))))); end return tmp end
b_m = abs(b); function tmp_2 = code(a, b_m, angle) tmp = 0.0; if (b_m <= 1.1e-38) tmp = 0.011111111111111112 * (angle * (pi * (a * (b_m - a)))); else tmp = 0.011111111111111112 * (angle * (pi * (b_m * (b_m - a)))); end tmp_2 = tmp; end
b_m = N[Abs[b], $MachinePrecision] code[a_, b$95$m_, angle_] := If[LessEqual[b$95$m, 1.1e-38], N[(0.011111111111111112 * N[(angle * N[(Pi * N[(a * N[(b$95$m - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.011111111111111112 * N[(angle * N[(Pi * N[(b$95$m * N[(b$95$m - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
b_m = \left|b\right|
\\
\begin{array}{l}
\mathbf{if}\;b\_m \leq 1.1 \cdot 10^{-38}:\\
\;\;\;\;0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \left(a \cdot \left(b\_m - a\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \left(b\_m \cdot \left(b\_m - a\right)\right)\right)\right)\\
\end{array}
\end{array}
if b < 1.10000000000000004e-38Initial program 61.7%
Taylor expanded in angle around 0 61.0%
unpow261.0%
unpow261.0%
difference-of-squares65.2%
Applied egg-rr65.2%
Taylor expanded in b around 0 48.1%
if 1.10000000000000004e-38 < b Initial program 54.8%
Taylor expanded in angle around 0 46.7%
unpow246.7%
unpow246.7%
difference-of-squares54.5%
Applied egg-rr54.5%
Taylor expanded in b around inf 47.6%
b_m = (fabs.f64 b) (FPCore (a b_m angle) :precision binary64 (* 0.011111111111111112 (* angle (* PI (* a (- b_m a))))))
b_m = fabs(b);
double code(double a, double b_m, double angle) {
return 0.011111111111111112 * (angle * (((double) M_PI) * (a * (b_m - a))));
}
b_m = Math.abs(b);
public static double code(double a, double b_m, double angle) {
return 0.011111111111111112 * (angle * (Math.PI * (a * (b_m - a))));
}
b_m = math.fabs(b) def code(a, b_m, angle): return 0.011111111111111112 * (angle * (math.pi * (a * (b_m - a))))
b_m = abs(b) function code(a, b_m, angle) return Float64(0.011111111111111112 * Float64(angle * Float64(pi * Float64(a * Float64(b_m - a))))) end
b_m = abs(b); function tmp = code(a, b_m, angle) tmp = 0.011111111111111112 * (angle * (pi * (a * (b_m - a)))); end
b_m = N[Abs[b], $MachinePrecision] code[a_, b$95$m_, angle_] := N[(0.011111111111111112 * N[(angle * N[(Pi * N[(a * N[(b$95$m - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \left(a \cdot \left(b\_m - a\right)\right)\right)\right)
\end{array}
Initial program 59.9%
Taylor expanded in angle around 0 57.3%
unpow257.3%
unpow257.3%
difference-of-squares62.4%
Applied egg-rr62.4%
Taylor expanded in b around 0 40.2%
b_m = (fabs.f64 b) (FPCore (a b_m angle) :precision binary64 (* 0.011111111111111112 (* angle (* a (* b_m PI)))))
b_m = fabs(b);
double code(double a, double b_m, double angle) {
return 0.011111111111111112 * (angle * (a * (b_m * ((double) M_PI))));
}
b_m = Math.abs(b);
public static double code(double a, double b_m, double angle) {
return 0.011111111111111112 * (angle * (a * (b_m * Math.PI)));
}
b_m = math.fabs(b) def code(a, b_m, angle): return 0.011111111111111112 * (angle * (a * (b_m * math.pi)))
b_m = abs(b) function code(a, b_m, angle) return Float64(0.011111111111111112 * Float64(angle * Float64(a * Float64(b_m * pi)))) end
b_m = abs(b); function tmp = code(a, b_m, angle) tmp = 0.011111111111111112 * (angle * (a * (b_m * pi))); end
b_m = N[Abs[b], $MachinePrecision] code[a_, b$95$m_, angle_] := N[(0.011111111111111112 * N[(angle * N[(a * N[(b$95$m * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
0.011111111111111112 \cdot \left(angle \cdot \left(a \cdot \left(b\_m \cdot \pi\right)\right)\right)
\end{array}
Initial program 59.9%
Taylor expanded in angle around 0 57.3%
unpow257.3%
unpow257.3%
difference-of-squares62.4%
Applied egg-rr62.4%
Taylor expanded in b around 0 40.2%
Taylor expanded in a around 0 19.3%
*-commutative19.3%
Simplified19.3%
Final simplification19.3%
b_m = (fabs.f64 b) (FPCore (a b_m angle) :precision binary64 (* 0.011111111111111112 (* a (* angle (* b_m PI)))))
b_m = fabs(b);
double code(double a, double b_m, double angle) {
return 0.011111111111111112 * (a * (angle * (b_m * ((double) M_PI))));
}
b_m = Math.abs(b);
public static double code(double a, double b_m, double angle) {
return 0.011111111111111112 * (a * (angle * (b_m * Math.PI)));
}
b_m = math.fabs(b) def code(a, b_m, angle): return 0.011111111111111112 * (a * (angle * (b_m * math.pi)))
b_m = abs(b) function code(a, b_m, angle) return Float64(0.011111111111111112 * Float64(a * Float64(angle * Float64(b_m * pi)))) end
b_m = abs(b); function tmp = code(a, b_m, angle) tmp = 0.011111111111111112 * (a * (angle * (b_m * pi))); end
b_m = N[Abs[b], $MachinePrecision] code[a_, b$95$m_, angle_] := N[(0.011111111111111112 * N[(a * N[(angle * N[(b$95$m * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
0.011111111111111112 \cdot \left(a \cdot \left(angle \cdot \left(b\_m \cdot \pi\right)\right)\right)
\end{array}
Initial program 59.9%
Taylor expanded in angle around 0 57.3%
unpow257.3%
unpow257.3%
difference-of-squares62.4%
Applied egg-rr62.4%
Taylor expanded in b around 0 40.2%
Taylor expanded in a around 0 18.6%
*-commutative18.6%
Simplified18.6%
Final simplification18.6%
herbie shell --seed 2024186
(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)))))