
(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}
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}
Herbie found 16 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}
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}
(FPCore (a b angle)
:precision binary64
(*
(copysign 1.0 angle)
(if (<= (* 2.0 (- (pow b 2.0) (pow a 2.0))) 5e+116)
(*
(*
(+ b a)
(* (- b a) (* 2.0 (sin (* (* 0.005555555555555556 (fabs angle)) PI)))))
(sin (fma -0.005555555555555556 (* PI (fabs angle)) (* PI 0.5))))
(*
(+ a b)
(*
(- b a)
(sin
(*
(fabs angle)
(* (* (cbrt PI) 2.1450293971110255) 0.011111111111111112))))))))double code(double a, double b, double angle) {
double tmp;
if ((2.0 * (pow(b, 2.0) - pow(a, 2.0))) <= 5e+116) {
tmp = ((b + a) * ((b - a) * (2.0 * sin(((0.005555555555555556 * fabs(angle)) * ((double) M_PI)))))) * sin(fma(-0.005555555555555556, (((double) M_PI) * fabs(angle)), (((double) M_PI) * 0.5)));
} else {
tmp = (a + b) * ((b - a) * sin((fabs(angle) * ((cbrt(((double) M_PI)) * 2.1450293971110255) * 0.011111111111111112))));
}
return copysign(1.0, angle) * tmp;
}
function code(a, b, angle) tmp = 0.0 if (Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) <= 5e+116) tmp = Float64(Float64(Float64(b + a) * Float64(Float64(b - a) * Float64(2.0 * sin(Float64(Float64(0.005555555555555556 * abs(angle)) * pi))))) * sin(fma(-0.005555555555555556, Float64(pi * abs(angle)), Float64(pi * 0.5)))); else tmp = Float64(Float64(a + b) * Float64(Float64(b - a) * sin(Float64(abs(angle) * Float64(Float64(cbrt(pi) * 2.1450293971110255) * 0.011111111111111112))))); end return Float64(copysign(1.0, angle) * tmp) end
code[a_, b_, angle_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+116], N[(N[(N[(b + a), $MachinePrecision] * N[(N[(b - a), $MachinePrecision] * N[(2.0 * N[Sin[N[(N[(0.005555555555555556 * N[Abs[angle], $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(-0.005555555555555556 * N[(Pi * N[Abs[angle], $MachinePrecision]), $MachinePrecision] + N[(Pi * 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(a + b), $MachinePrecision] * N[(N[(b - a), $MachinePrecision] * N[Sin[N[(N[Abs[angle], $MachinePrecision] * N[(N[(N[Power[Pi, 1/3], $MachinePrecision] * 2.1450293971110255), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, angle\right) \cdot \begin{array}{l}
\mathbf{if}\;2 \cdot \left({b}^{2} - {a}^{2}\right) \leq 5 \cdot 10^{+116}:\\
\;\;\;\;\left(\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \left(2 \cdot \sin \left(\left(0.005555555555555556 \cdot \left|angle\right|\right) \cdot \pi\right)\right)\right)\right) \cdot \sin \left(\mathsf{fma}\left(-0.005555555555555556, \pi \cdot \left|angle\right|, \pi \cdot 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a + b\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\left|angle\right| \cdot \left(\left(\sqrt[3]{\pi} \cdot 2.1450293971110255\right) \cdot 0.011111111111111112\right)\right)\right)\\
\end{array}
if (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) < 5.00000000000000025e116Initial program 54.4%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squaresN/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f6457.8%
Applied rewrites57.8%
lift-cos.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
lift-*.f64N/A
div-flip-revN/A
lift-/.f64N/A
lift-/.f64N/A
cos-neg-revN/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
metadata-evalN/A
distribute-lft-neg-inN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
Applied rewrites57.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6466.9%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
mult-flipN/A
metadata-evalN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f6466.9%
Applied rewrites66.9%
if 5.00000000000000025e116 < (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) Initial program 54.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squaresN/A
lift-sin.f64N/A
lift-cos.f64N/A
Applied rewrites66.8%
lift-*.f64N/A
lift-PI.f64N/A
add-cube-cbrtN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
pow1/3N/A
lift-PI.f64N/A
pow1/3N/A
pow-prod-upN/A
lower-pow.f64N/A
metadata-evalN/A
lift-PI.f64N/A
lower-cbrt.f6466.8%
Applied rewrites66.8%
Evaluated real constant66.8%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6466.7%
Applied rewrites66.7%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (+ b (fabs a)))
(t_1 (- b (fabs a)))
(t_2 (* 0.005555555555555556 (fabs angle))))
(*
(copysign 1.0 angle)
(if (<= (fabs angle) 1e+58)
(*
t_1
(*
(* 2.0 t_0)
(*
(cos (* -0.005555555555555556 (* PI (fabs angle))))
(sin (* t_2 PI)))))
(*
(* t_1 t_0)
(sin (* 2.0 (* (pow PI 0.6666666666666666) (* (cbrt PI) t_2)))))))))double code(double a, double b, double angle) {
double t_0 = b + fabs(a);
double t_1 = b - fabs(a);
double t_2 = 0.005555555555555556 * fabs(angle);
double tmp;
if (fabs(angle) <= 1e+58) {
tmp = t_1 * ((2.0 * t_0) * (cos((-0.005555555555555556 * (((double) M_PI) * fabs(angle)))) * sin((t_2 * ((double) M_PI)))));
} else {
tmp = (t_1 * t_0) * sin((2.0 * (pow(((double) M_PI), 0.6666666666666666) * (cbrt(((double) M_PI)) * t_2))));
}
return copysign(1.0, angle) * tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = b + Math.abs(a);
double t_1 = b - Math.abs(a);
double t_2 = 0.005555555555555556 * Math.abs(angle);
double tmp;
if (Math.abs(angle) <= 1e+58) {
tmp = t_1 * ((2.0 * t_0) * (Math.cos((-0.005555555555555556 * (Math.PI * Math.abs(angle)))) * Math.sin((t_2 * Math.PI))));
} else {
tmp = (t_1 * t_0) * Math.sin((2.0 * (Math.pow(Math.PI, 0.6666666666666666) * (Math.cbrt(Math.PI) * t_2))));
}
return Math.copySign(1.0, angle) * tmp;
}
function code(a, b, angle) t_0 = Float64(b + abs(a)) t_1 = Float64(b - abs(a)) t_2 = Float64(0.005555555555555556 * abs(angle)) tmp = 0.0 if (abs(angle) <= 1e+58) tmp = Float64(t_1 * Float64(Float64(2.0 * t_0) * Float64(cos(Float64(-0.005555555555555556 * Float64(pi * abs(angle)))) * sin(Float64(t_2 * pi))))); else tmp = Float64(Float64(t_1 * t_0) * sin(Float64(2.0 * Float64((pi ^ 0.6666666666666666) * Float64(cbrt(pi) * t_2))))); end return Float64(copysign(1.0, angle) * tmp) end
code[a_, b_, angle_] := Block[{t$95$0 = N[(b + N[Abs[a], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(b - N[Abs[a], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(0.005555555555555556 * N[Abs[angle], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[angle], $MachinePrecision], 1e+58], N[(t$95$1 * N[(N[(2.0 * t$95$0), $MachinePrecision] * N[(N[Cos[N[(-0.005555555555555556 * N[(Pi * N[Abs[angle], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(t$95$2 * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 * t$95$0), $MachinePrecision] * N[Sin[N[(2.0 * N[(N[Power[Pi, 0.6666666666666666], $MachinePrecision] * N[(N[Power[Pi, 1/3], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := b + \left|a\right|\\
t_1 := b - \left|a\right|\\
t_2 := 0.005555555555555556 \cdot \left|angle\right|\\
\mathsf{copysign}\left(1, angle\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|angle\right| \leq 10^{+58}:\\
\;\;\;\;t\_1 \cdot \left(\left(2 \cdot t\_0\right) \cdot \left(\cos \left(-0.005555555555555556 \cdot \left(\pi \cdot \left|angle\right|\right)\right) \cdot \sin \left(t\_2 \cdot \pi\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 \cdot t\_0\right) \cdot \sin \left(2 \cdot \left({\pi}^{0.6666666666666666} \cdot \left(\sqrt[3]{\pi} \cdot t\_2\right)\right)\right)\\
\end{array}
\end{array}
if angle < 9.99999999999999944e57Initial program 54.4%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squaresN/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f6457.8%
Applied rewrites57.8%
Applied rewrites57.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.8%
Applied rewrites66.7%
if 9.99999999999999944e57 < angle Initial program 54.4%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squaresN/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f6457.8%
Applied rewrites57.8%
Applied rewrites57.5%
Applied rewrites58.1%
lift-*.f64N/A
*-commutativeN/A
lift-PI.f64N/A
add-cube-cbrtN/A
lift-PI.f64N/A
lift-cbrt.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-PI.f64N/A
pow1/3N/A
lift-PI.f64N/A
pow1/3N/A
pow-prod-upN/A
lower-pow.f64N/A
metadata-evalN/A
lower-*.f6457.7%
Applied rewrites57.7%
(FPCore (a b angle)
:precision binary64
(*
(copysign 1.0 angle)
(if (<= (fabs angle) 2e+96)
(* (+ a b) (* (- b a) (sin (* (* 0.011111111111111112 PI) (fabs angle)))))
(*
(* (- b a) (+ b a))
(sin
(*
2.0
(*
(pow PI 0.6666666666666666)
(* (cbrt PI) (* 0.005555555555555556 (fabs angle))))))))))double code(double a, double b, double angle) {
double tmp;
if (fabs(angle) <= 2e+96) {
tmp = (a + b) * ((b - a) * sin(((0.011111111111111112 * ((double) M_PI)) * fabs(angle))));
} else {
tmp = ((b - a) * (b + a)) * sin((2.0 * (pow(((double) M_PI), 0.6666666666666666) * (cbrt(((double) M_PI)) * (0.005555555555555556 * fabs(angle))))));
}
return copysign(1.0, angle) * tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (Math.abs(angle) <= 2e+96) {
tmp = (a + b) * ((b - a) * Math.sin(((0.011111111111111112 * Math.PI) * Math.abs(angle))));
} else {
tmp = ((b - a) * (b + a)) * Math.sin((2.0 * (Math.pow(Math.PI, 0.6666666666666666) * (Math.cbrt(Math.PI) * (0.005555555555555556 * Math.abs(angle))))));
}
return Math.copySign(1.0, angle) * tmp;
}
function code(a, b, angle) tmp = 0.0 if (abs(angle) <= 2e+96) tmp = Float64(Float64(a + b) * Float64(Float64(b - a) * sin(Float64(Float64(0.011111111111111112 * pi) * abs(angle))))); else tmp = Float64(Float64(Float64(b - a) * Float64(b + a)) * sin(Float64(2.0 * Float64((pi ^ 0.6666666666666666) * Float64(cbrt(pi) * Float64(0.005555555555555556 * abs(angle))))))); end return Float64(copysign(1.0, angle) * tmp) end
code[a_, b_, angle_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[angle], $MachinePrecision], 2e+96], N[(N[(a + b), $MachinePrecision] * N[(N[(b - a), $MachinePrecision] * N[Sin[N[(N[(0.011111111111111112 * Pi), $MachinePrecision] * N[Abs[angle], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(b - a), $MachinePrecision] * N[(b + a), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(2.0 * N[(N[Power[Pi, 0.6666666666666666], $MachinePrecision] * N[(N[Power[Pi, 1/3], $MachinePrecision] * N[(0.005555555555555556 * N[Abs[angle], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, angle\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|angle\right| \leq 2 \cdot 10^{+96}:\\
\;\;\;\;\left(a + b\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\left(0.011111111111111112 \cdot \pi\right) \cdot \left|angle\right|\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(b - a\right) \cdot \left(b + a\right)\right) \cdot \sin \left(2 \cdot \left({\pi}^{0.6666666666666666} \cdot \left(\sqrt[3]{\pi} \cdot \left(0.005555555555555556 \cdot \left|angle\right|\right)\right)\right)\right)\\
\end{array}
if angle < 2.0000000000000001e96Initial program 54.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squaresN/A
lift-sin.f64N/A
lift-cos.f64N/A
Applied rewrites66.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6467.0%
Applied rewrites67.0%
if 2.0000000000000001e96 < angle Initial program 54.4%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squaresN/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f6457.8%
Applied rewrites57.8%
Applied rewrites57.5%
Applied rewrites58.1%
lift-*.f64N/A
*-commutativeN/A
lift-PI.f64N/A
add-cube-cbrtN/A
lift-PI.f64N/A
lift-cbrt.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-PI.f64N/A
pow1/3N/A
lift-PI.f64N/A
pow1/3N/A
pow-prod-upN/A
lower-pow.f64N/A
metadata-evalN/A
lower-*.f6457.7%
Applied rewrites57.7%
(FPCore (a b angle)
:precision binary64
(*
(copysign 1.0 angle)
(if (<= (fabs angle) 1e-26)
(* (+ a b) (* 0.011111111111111112 (* (fabs angle) (* PI (- b a)))))
(*
(* (- b a) (+ b a))
(sin (* (* 0.011111111111111112 PI) (fabs angle)))))))double code(double a, double b, double angle) {
double tmp;
if (fabs(angle) <= 1e-26) {
tmp = (a + b) * (0.011111111111111112 * (fabs(angle) * (((double) M_PI) * (b - a))));
} else {
tmp = ((b - a) * (b + a)) * sin(((0.011111111111111112 * ((double) M_PI)) * fabs(angle)));
}
return copysign(1.0, angle) * tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (Math.abs(angle) <= 1e-26) {
tmp = (a + b) * (0.011111111111111112 * (Math.abs(angle) * (Math.PI * (b - a))));
} else {
tmp = ((b - a) * (b + a)) * Math.sin(((0.011111111111111112 * Math.PI) * Math.abs(angle)));
}
return Math.copySign(1.0, angle) * tmp;
}
def code(a, b, angle): tmp = 0 if math.fabs(angle) <= 1e-26: tmp = (a + b) * (0.011111111111111112 * (math.fabs(angle) * (math.pi * (b - a)))) else: tmp = ((b - a) * (b + a)) * math.sin(((0.011111111111111112 * math.pi) * math.fabs(angle))) return math.copysign(1.0, angle) * tmp
function code(a, b, angle) tmp = 0.0 if (abs(angle) <= 1e-26) tmp = Float64(Float64(a + b) * Float64(0.011111111111111112 * Float64(abs(angle) * Float64(pi * Float64(b - a))))); else tmp = Float64(Float64(Float64(b - a) * Float64(b + a)) * sin(Float64(Float64(0.011111111111111112 * pi) * abs(angle)))); end return Float64(copysign(1.0, angle) * tmp) end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (abs(angle) <= 1e-26) tmp = (a + b) * (0.011111111111111112 * (abs(angle) * (pi * (b - a)))); else tmp = ((b - a) * (b + a)) * sin(((0.011111111111111112 * pi) * abs(angle))); end tmp_2 = (sign(angle) * abs(1.0)) * tmp; end
code[a_, b_, angle_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[angle], $MachinePrecision], 1e-26], N[(N[(a + b), $MachinePrecision] * N[(0.011111111111111112 * N[(N[Abs[angle], $MachinePrecision] * N[(Pi * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(b - a), $MachinePrecision] * N[(b + a), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(N[(0.011111111111111112 * Pi), $MachinePrecision] * N[Abs[angle], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, angle\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|angle\right| \leq 10^{-26}:\\
\;\;\;\;\left(a + b\right) \cdot \left(0.011111111111111112 \cdot \left(\left|angle\right| \cdot \left(\pi \cdot \left(b - a\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(b - a\right) \cdot \left(b + a\right)\right) \cdot \sin \left(\left(0.011111111111111112 \cdot \pi\right) \cdot \left|angle\right|\right)\\
\end{array}
if angle < 1e-26Initial program 54.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squaresN/A
lift-sin.f64N/A
lift-cos.f64N/A
Applied rewrites66.8%
Taylor expanded in a around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6441.8%
Applied rewrites41.8%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6440.3%
Applied rewrites40.3%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
lower--.f6462.3%
Applied rewrites62.3%
if 1e-26 < angle Initial program 54.4%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squaresN/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f6457.8%
Applied rewrites57.8%
Applied rewrites57.5%
Applied rewrites58.1%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
associate-*r*N/A
metadata-evalN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6457.7%
Applied rewrites57.7%
(FPCore (a b angle) :precision binary64 (* (+ a b) (* (- b a) (sin (* (* (* angle 2.1450293971110255) (cbrt PI)) 0.011111111111111112)))))
double code(double a, double b, double angle) {
return (a + b) * ((b - a) * sin((((angle * 2.1450293971110255) * cbrt(((double) M_PI))) * 0.011111111111111112)));
}
public static double code(double a, double b, double angle) {
return (a + b) * ((b - a) * Math.sin((((angle * 2.1450293971110255) * Math.cbrt(Math.PI)) * 0.011111111111111112)));
}
function code(a, b, angle) return Float64(Float64(a + b) * Float64(Float64(b - a) * sin(Float64(Float64(Float64(angle * 2.1450293971110255) * cbrt(pi)) * 0.011111111111111112)))) end
code[a_, b_, angle_] := N[(N[(a + b), $MachinePrecision] * N[(N[(b - a), $MachinePrecision] * N[Sin[N[(N[(N[(angle * 2.1450293971110255), $MachinePrecision] * N[Power[Pi, 1/3], $MachinePrecision]), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(a + b\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\left(\left(angle \cdot 2.1450293971110255\right) \cdot \sqrt[3]{\pi}\right) \cdot 0.011111111111111112\right)\right)
Initial program 54.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squaresN/A
lift-sin.f64N/A
lift-cos.f64N/A
Applied rewrites66.8%
lift-*.f64N/A
lift-PI.f64N/A
add-cube-cbrtN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
pow1/3N/A
lift-PI.f64N/A
pow1/3N/A
pow-prod-upN/A
lower-pow.f64N/A
metadata-evalN/A
lift-PI.f64N/A
lower-cbrt.f6466.8%
Applied rewrites66.8%
Evaluated real constant66.8%
(FPCore (a b angle) :precision binary64 (* (+ a b) (* (- b a) (sin (* (* 0.011111111111111112 PI) angle)))))
double code(double a, double b, double angle) {
return (a + b) * ((b - a) * sin(((0.011111111111111112 * ((double) M_PI)) * angle)));
}
public static double code(double a, double b, double angle) {
return (a + b) * ((b - a) * Math.sin(((0.011111111111111112 * Math.PI) * angle)));
}
def code(a, b, angle): return (a + b) * ((b - a) * math.sin(((0.011111111111111112 * math.pi) * angle)))
function code(a, b, angle) return Float64(Float64(a + b) * Float64(Float64(b - a) * sin(Float64(Float64(0.011111111111111112 * pi) * angle)))) end
function tmp = code(a, b, angle) tmp = (a + b) * ((b - a) * sin(((0.011111111111111112 * pi) * angle))); end
code[a_, b_, angle_] := N[(N[(a + b), $MachinePrecision] * N[(N[(b - a), $MachinePrecision] * N[Sin[N[(N[(0.011111111111111112 * Pi), $MachinePrecision] * angle), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(a + b\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\left(0.011111111111111112 \cdot \pi\right) \cdot angle\right)\right)
Initial program 54.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squaresN/A
lift-sin.f64N/A
lift-cos.f64N/A
Applied rewrites66.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6467.0%
Applied rewrites67.0%
(FPCore (a b angle)
:precision binary64
(*
(copysign 1.0 angle)
(if (<= (fabs angle) 5e-16)
(* (+ a b) (* 0.011111111111111112 (* (fabs angle) (* PI (- b a)))))
(*
(* (- b a) (+ a b))
(sin (* (* (fabs angle) PI) 0.011111111111111112))))))double code(double a, double b, double angle) {
double tmp;
if (fabs(angle) <= 5e-16) {
tmp = (a + b) * (0.011111111111111112 * (fabs(angle) * (((double) M_PI) * (b - a))));
} else {
tmp = ((b - a) * (a + b)) * sin(((fabs(angle) * ((double) M_PI)) * 0.011111111111111112));
}
return copysign(1.0, angle) * tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (Math.abs(angle) <= 5e-16) {
tmp = (a + b) * (0.011111111111111112 * (Math.abs(angle) * (Math.PI * (b - a))));
} else {
tmp = ((b - a) * (a + b)) * Math.sin(((Math.abs(angle) * Math.PI) * 0.011111111111111112));
}
return Math.copySign(1.0, angle) * tmp;
}
def code(a, b, angle): tmp = 0 if math.fabs(angle) <= 5e-16: tmp = (a + b) * (0.011111111111111112 * (math.fabs(angle) * (math.pi * (b - a)))) else: tmp = ((b - a) * (a + b)) * math.sin(((math.fabs(angle) * math.pi) * 0.011111111111111112)) return math.copysign(1.0, angle) * tmp
function code(a, b, angle) tmp = 0.0 if (abs(angle) <= 5e-16) tmp = Float64(Float64(a + b) * Float64(0.011111111111111112 * Float64(abs(angle) * Float64(pi * Float64(b - a))))); else tmp = Float64(Float64(Float64(b - a) * Float64(a + b)) * sin(Float64(Float64(abs(angle) * pi) * 0.011111111111111112))); end return Float64(copysign(1.0, angle) * tmp) end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (abs(angle) <= 5e-16) tmp = (a + b) * (0.011111111111111112 * (abs(angle) * (pi * (b - a)))); else tmp = ((b - a) * (a + b)) * sin(((abs(angle) * pi) * 0.011111111111111112)); end tmp_2 = (sign(angle) * abs(1.0)) * tmp; end
code[a_, b_, angle_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[angle], $MachinePrecision], 5e-16], N[(N[(a + b), $MachinePrecision] * N[(0.011111111111111112 * N[(N[Abs[angle], $MachinePrecision] * N[(Pi * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(b - a), $MachinePrecision] * N[(a + b), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(N[(N[Abs[angle], $MachinePrecision] * Pi), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, angle\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|angle\right| \leq 5 \cdot 10^{-16}:\\
\;\;\;\;\left(a + b\right) \cdot \left(0.011111111111111112 \cdot \left(\left|angle\right| \cdot \left(\pi \cdot \left(b - a\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(b - a\right) \cdot \left(a + b\right)\right) \cdot \sin \left(\left(\left|angle\right| \cdot \pi\right) \cdot 0.011111111111111112\right)\\
\end{array}
if angle < 5.0000000000000004e-16Initial program 54.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squaresN/A
lift-sin.f64N/A
lift-cos.f64N/A
Applied rewrites66.8%
Taylor expanded in a around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6441.8%
Applied rewrites41.8%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6440.3%
Applied rewrites40.3%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
lower--.f6462.3%
Applied rewrites62.3%
if 5.0000000000000004e-16 < angle Initial program 54.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-sin.f64N/A
lift-cos.f64N/A
2-sinN/A
count-2N/A
Applied rewrites57.6%
(FPCore (a b angle) :precision binary64 (* (- b (fabs a)) (* (sin (* 0.011111111111111112 (* PI angle))) (+ b (fabs a)))))
double code(double a, double b, double angle) {
return (b - fabs(a)) * (sin((0.011111111111111112 * (((double) M_PI) * angle))) * (b + fabs(a)));
}
public static double code(double a, double b, double angle) {
return (b - Math.abs(a)) * (Math.sin((0.011111111111111112 * (Math.PI * angle))) * (b + Math.abs(a)));
}
def code(a, b, angle): return (b - math.fabs(a)) * (math.sin((0.011111111111111112 * (math.pi * angle))) * (b + math.fabs(a)))
function code(a, b, angle) return Float64(Float64(b - abs(a)) * Float64(sin(Float64(0.011111111111111112 * Float64(pi * angle))) * Float64(b + abs(a)))) end
function tmp = code(a, b, angle) tmp = (b - abs(a)) * (sin((0.011111111111111112 * (pi * angle))) * (b + abs(a))); end
code[a_, b_, angle_] := N[(N[(b - N[Abs[a], $MachinePrecision]), $MachinePrecision] * N[(N[Sin[N[(0.011111111111111112 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(b + N[Abs[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(b - \left|a\right|\right) \cdot \left(\sin \left(0.011111111111111112 \cdot \left(\pi \cdot angle\right)\right) \cdot \left(b + \left|a\right|\right)\right)
Initial program 54.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squaresN/A
lift-sin.f64N/A
lift-cos.f64N/A
Applied rewrites66.8%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6466.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.8%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6466.8%
Applied rewrites66.8%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (- (fabs b) (fabs a))))
(*
(copysign 1.0 angle)
(if (<= (fabs angle) 4.3e+122)
(*
(+ (fabs a) (fabs b))
(* 0.011111111111111112 (* (fabs angle) (* PI t_0))))
(*
(/ (* t_0 (+ (fabs b) (fabs a))) t_0)
(* 0.011111111111111112 (* (fabs angle) (* (fabs b) PI))))))))double code(double a, double b, double angle) {
double t_0 = fabs(b) - fabs(a);
double tmp;
if (fabs(angle) <= 4.3e+122) {
tmp = (fabs(a) + fabs(b)) * (0.011111111111111112 * (fabs(angle) * (((double) M_PI) * t_0)));
} else {
tmp = ((t_0 * (fabs(b) + fabs(a))) / t_0) * (0.011111111111111112 * (fabs(angle) * (fabs(b) * ((double) M_PI))));
}
return copysign(1.0, angle) * tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = Math.abs(b) - Math.abs(a);
double tmp;
if (Math.abs(angle) <= 4.3e+122) {
tmp = (Math.abs(a) + Math.abs(b)) * (0.011111111111111112 * (Math.abs(angle) * (Math.PI * t_0)));
} else {
tmp = ((t_0 * (Math.abs(b) + Math.abs(a))) / t_0) * (0.011111111111111112 * (Math.abs(angle) * (Math.abs(b) * Math.PI)));
}
return Math.copySign(1.0, angle) * tmp;
}
def code(a, b, angle): t_0 = math.fabs(b) - math.fabs(a) tmp = 0 if math.fabs(angle) <= 4.3e+122: tmp = (math.fabs(a) + math.fabs(b)) * (0.011111111111111112 * (math.fabs(angle) * (math.pi * t_0))) else: tmp = ((t_0 * (math.fabs(b) + math.fabs(a))) / t_0) * (0.011111111111111112 * (math.fabs(angle) * (math.fabs(b) * math.pi))) return math.copysign(1.0, angle) * tmp
function code(a, b, angle) t_0 = Float64(abs(b) - abs(a)) tmp = 0.0 if (abs(angle) <= 4.3e+122) tmp = Float64(Float64(abs(a) + abs(b)) * Float64(0.011111111111111112 * Float64(abs(angle) * Float64(pi * t_0)))); else tmp = Float64(Float64(Float64(t_0 * Float64(abs(b) + abs(a))) / t_0) * Float64(0.011111111111111112 * Float64(abs(angle) * Float64(abs(b) * pi)))); end return Float64(copysign(1.0, angle) * tmp) end
function tmp_2 = code(a, b, angle) t_0 = abs(b) - abs(a); tmp = 0.0; if (abs(angle) <= 4.3e+122) tmp = (abs(a) + abs(b)) * (0.011111111111111112 * (abs(angle) * (pi * t_0))); else tmp = ((t_0 * (abs(b) + abs(a))) / t_0) * (0.011111111111111112 * (abs(angle) * (abs(b) * pi))); end tmp_2 = (sign(angle) * abs(1.0)) * tmp; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[Abs[b], $MachinePrecision] - N[Abs[a], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[angle], $MachinePrecision], 4.3e+122], N[(N[(N[Abs[a], $MachinePrecision] + N[Abs[b], $MachinePrecision]), $MachinePrecision] * N[(0.011111111111111112 * N[(N[Abs[angle], $MachinePrecision] * N[(Pi * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t$95$0 * N[(N[Abs[b], $MachinePrecision] + N[Abs[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision] * N[(0.011111111111111112 * N[(N[Abs[angle], $MachinePrecision] * N[(N[Abs[b], $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
t_0 := \left|b\right| - \left|a\right|\\
\mathsf{copysign}\left(1, angle\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|angle\right| \leq 4.3 \cdot 10^{+122}:\\
\;\;\;\;\left(\left|a\right| + \left|b\right|\right) \cdot \left(0.011111111111111112 \cdot \left(\left|angle\right| \cdot \left(\pi \cdot t\_0\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0 \cdot \left(\left|b\right| + \left|a\right|\right)}{t\_0} \cdot \left(0.011111111111111112 \cdot \left(\left|angle\right| \cdot \left(\left|b\right| \cdot \pi\right)\right)\right)\\
\end{array}
\end{array}
if angle < 4.29999999999999971e122Initial program 54.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squaresN/A
lift-sin.f64N/A
lift-cos.f64N/A
Applied rewrites66.8%
Taylor expanded in a around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6441.8%
Applied rewrites41.8%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6440.3%
Applied rewrites40.3%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
lower--.f6462.3%
Applied rewrites62.3%
if 4.29999999999999971e122 < angle Initial program 54.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squaresN/A
lift-sin.f64N/A
lift-cos.f64N/A
Applied rewrites66.8%
Taylor expanded in a around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6441.8%
Applied rewrites41.8%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6440.3%
Applied rewrites40.3%
lift-+.f64N/A
+-commutativeN/A
flip-+N/A
lower-unsound--.f64N/A
lower-unsound-/.f64N/A
lower-unsound--.f32N/A
lower--.f32N/A
lower-unsound-*.f32N/A
lower-*.f32N/A
lower-unsound-*.f32N/A
lower-*.f32N/A
difference-of-squares-revN/A
lift-+.f64N/A
lift--.f64N/A
*-commutativeN/A
lift-*.f6440.5%
Applied rewrites40.5%
(FPCore (a b angle)
:precision binary64
(*
(copysign 1.0 angle)
(if (<= (fabs angle) 4.5e+122)
(*
(+ (fabs a) (fabs b))
(* 0.011111111111111112 (* (fabs angle) (* PI (- (fabs b) (fabs a))))))
(*
(* (+ 1.0 (/ (fabs a) (fabs b))) (fabs b))
(* 0.011111111111111112 (* (fabs angle) (* (fabs b) PI)))))))double code(double a, double b, double angle) {
double tmp;
if (fabs(angle) <= 4.5e+122) {
tmp = (fabs(a) + fabs(b)) * (0.011111111111111112 * (fabs(angle) * (((double) M_PI) * (fabs(b) - fabs(a)))));
} else {
tmp = ((1.0 + (fabs(a) / fabs(b))) * fabs(b)) * (0.011111111111111112 * (fabs(angle) * (fabs(b) * ((double) M_PI))));
}
return copysign(1.0, angle) * tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (Math.abs(angle) <= 4.5e+122) {
tmp = (Math.abs(a) + Math.abs(b)) * (0.011111111111111112 * (Math.abs(angle) * (Math.PI * (Math.abs(b) - Math.abs(a)))));
} else {
tmp = ((1.0 + (Math.abs(a) / Math.abs(b))) * Math.abs(b)) * (0.011111111111111112 * (Math.abs(angle) * (Math.abs(b) * Math.PI)));
}
return Math.copySign(1.0, angle) * tmp;
}
def code(a, b, angle): tmp = 0 if math.fabs(angle) <= 4.5e+122: tmp = (math.fabs(a) + math.fabs(b)) * (0.011111111111111112 * (math.fabs(angle) * (math.pi * (math.fabs(b) - math.fabs(a))))) else: tmp = ((1.0 + (math.fabs(a) / math.fabs(b))) * math.fabs(b)) * (0.011111111111111112 * (math.fabs(angle) * (math.fabs(b) * math.pi))) return math.copysign(1.0, angle) * tmp
function code(a, b, angle) tmp = 0.0 if (abs(angle) <= 4.5e+122) tmp = Float64(Float64(abs(a) + abs(b)) * Float64(0.011111111111111112 * Float64(abs(angle) * Float64(pi * Float64(abs(b) - abs(a)))))); else tmp = Float64(Float64(Float64(1.0 + Float64(abs(a) / abs(b))) * abs(b)) * Float64(0.011111111111111112 * Float64(abs(angle) * Float64(abs(b) * pi)))); end return Float64(copysign(1.0, angle) * tmp) end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (abs(angle) <= 4.5e+122) tmp = (abs(a) + abs(b)) * (0.011111111111111112 * (abs(angle) * (pi * (abs(b) - abs(a))))); else tmp = ((1.0 + (abs(a) / abs(b))) * abs(b)) * (0.011111111111111112 * (abs(angle) * (abs(b) * pi))); end tmp_2 = (sign(angle) * abs(1.0)) * tmp; end
code[a_, b_, angle_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[angle], $MachinePrecision], 4.5e+122], N[(N[(N[Abs[a], $MachinePrecision] + N[Abs[b], $MachinePrecision]), $MachinePrecision] * N[(0.011111111111111112 * N[(N[Abs[angle], $MachinePrecision] * N[(Pi * N[(N[Abs[b], $MachinePrecision] - N[Abs[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + N[(N[Abs[a], $MachinePrecision] / N[Abs[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision] * N[(0.011111111111111112 * N[(N[Abs[angle], $MachinePrecision] * N[(N[Abs[b], $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, angle\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|angle\right| \leq 4.5 \cdot 10^{+122}:\\
\;\;\;\;\left(\left|a\right| + \left|b\right|\right) \cdot \left(0.011111111111111112 \cdot \left(\left|angle\right| \cdot \left(\pi \cdot \left(\left|b\right| - \left|a\right|\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 + \frac{\left|a\right|}{\left|b\right|}\right) \cdot \left|b\right|\right) \cdot \left(0.011111111111111112 \cdot \left(\left|angle\right| \cdot \left(\left|b\right| \cdot \pi\right)\right)\right)\\
\end{array}
if angle < 4.49999999999999997e122Initial program 54.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squaresN/A
lift-sin.f64N/A
lift-cos.f64N/A
Applied rewrites66.8%
Taylor expanded in a around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6441.8%
Applied rewrites41.8%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6440.3%
Applied rewrites40.3%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
lower--.f6462.3%
Applied rewrites62.3%
if 4.49999999999999997e122 < angle Initial program 54.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squaresN/A
lift-sin.f64N/A
lift-cos.f64N/A
Applied rewrites66.8%
Taylor expanded in a around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6441.8%
Applied rewrites41.8%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6440.3%
Applied rewrites40.3%
lift-+.f64N/A
+-commutativeN/A
sum-to-multN/A
lower-unsound-*.f64N/A
lower-unsound-+.f64N/A
lower-unsound-/.f6442.6%
Applied rewrites42.6%
(FPCore (a b angle) :precision binary64 (* (+ a b) (* 0.011111111111111112 (* angle (* PI (- b a))))))
double code(double a, double b, double angle) {
return (a + b) * (0.011111111111111112 * (angle * (((double) M_PI) * (b - a))));
}
public static double code(double a, double b, double angle) {
return (a + b) * (0.011111111111111112 * (angle * (Math.PI * (b - a))));
}
def code(a, b, angle): return (a + b) * (0.011111111111111112 * (angle * (math.pi * (b - a))))
function code(a, b, angle) return Float64(Float64(a + b) * Float64(0.011111111111111112 * Float64(angle * Float64(pi * Float64(b - a))))) end
function tmp = code(a, b, angle) tmp = (a + b) * (0.011111111111111112 * (angle * (pi * (b - a)))); end
code[a_, b_, angle_] := N[(N[(a + b), $MachinePrecision] * N[(0.011111111111111112 * N[(angle * N[(Pi * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(a + b\right) \cdot \left(0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \left(b - a\right)\right)\right)\right)
Initial program 54.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squaresN/A
lift-sin.f64N/A
lift-cos.f64N/A
Applied rewrites66.8%
Taylor expanded in a around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6441.8%
Applied rewrites41.8%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6440.3%
Applied rewrites40.3%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
lower--.f6462.3%
Applied rewrites62.3%
(FPCore (a b angle) :precision binary64 (* (* (* 0.011111111111111112 (* angle (- b a))) (+ b a)) PI))
double code(double a, double b, double angle) {
return ((0.011111111111111112 * (angle * (b - a))) * (b + a)) * ((double) M_PI);
}
public static double code(double a, double b, double angle) {
return ((0.011111111111111112 * (angle * (b - a))) * (b + a)) * Math.PI;
}
def code(a, b, angle): return ((0.011111111111111112 * (angle * (b - a))) * (b + a)) * math.pi
function code(a, b, angle) return Float64(Float64(Float64(0.011111111111111112 * Float64(angle * Float64(b - a))) * Float64(b + a)) * pi) end
function tmp = code(a, b, angle) tmp = ((0.011111111111111112 * (angle * (b - a))) * (b + a)) * pi; end
code[a_, b_, angle_] := N[(N[(N[(0.011111111111111112 * N[(angle * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b + a), $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision]
\left(\left(0.011111111111111112 \cdot \left(angle \cdot \left(b - a\right)\right)\right) \cdot \left(b + a\right)\right) \cdot \pi
Initial program 54.4%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
lower--.f64N/A
lower-pow.f64N/A
lower-pow.f6451.3%
Applied rewrites51.3%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6451.4%
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squares-revN/A
+-commutativeN/A
lift-+.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f6454.7%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6454.7%
Applied rewrites54.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6462.3%
lift-+.f64N/A
+-commutativeN/A
lift-+.f6462.3%
Applied rewrites62.3%
(FPCore (a b angle) :precision binary64 (* 0.011111111111111112 (* (* angle (- b a)) (* (+ b a) PI))))
double code(double a, double b, double angle) {
return 0.011111111111111112 * ((angle * (b - a)) * ((b + a) * ((double) M_PI)));
}
public static double code(double a, double b, double angle) {
return 0.011111111111111112 * ((angle * (b - a)) * ((b + a) * Math.PI));
}
def code(a, b, angle): return 0.011111111111111112 * ((angle * (b - a)) * ((b + a) * math.pi))
function code(a, b, angle) return Float64(0.011111111111111112 * Float64(Float64(angle * Float64(b - a)) * Float64(Float64(b + a) * pi))) end
function tmp = code(a, b, angle) tmp = 0.011111111111111112 * ((angle * (b - a)) * ((b + a) * pi)); end
code[a_, b_, angle_] := N[(0.011111111111111112 * N[(N[(angle * N[(b - a), $MachinePrecision]), $MachinePrecision] * N[(N[(b + a), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
0.011111111111111112 \cdot \left(\left(angle \cdot \left(b - a\right)\right) \cdot \left(\left(b + a\right) \cdot \pi\right)\right)
Initial program 54.4%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
lower--.f64N/A
lower-pow.f64N/A
lower-pow.f6451.3%
Applied rewrites51.3%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6451.4%
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squares-revN/A
+-commutativeN/A
lift-+.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f6454.7%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6454.7%
Applied rewrites54.7%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6462.2%
lift-+.f64N/A
+-commutativeN/A
lift-+.f6462.2%
Applied rewrites62.2%
(FPCore (a b angle) :precision binary64 (if (<= (fabs b) 1.72e+111) (* 0.011111111111111112 (* (* angle (* (- (fabs b) a) (+ (fabs b) a))) PI)) (* (+ a (fabs b)) (* 0.011111111111111112 (* (* angle (fabs b)) PI)))))
double code(double a, double b, double angle) {
double tmp;
if (fabs(b) <= 1.72e+111) {
tmp = 0.011111111111111112 * ((angle * ((fabs(b) - a) * (fabs(b) + a))) * ((double) M_PI));
} else {
tmp = (a + fabs(b)) * (0.011111111111111112 * ((angle * fabs(b)) * ((double) M_PI)));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (Math.abs(b) <= 1.72e+111) {
tmp = 0.011111111111111112 * ((angle * ((Math.abs(b) - a) * (Math.abs(b) + a))) * Math.PI);
} else {
tmp = (a + Math.abs(b)) * (0.011111111111111112 * ((angle * Math.abs(b)) * Math.PI));
}
return tmp;
}
def code(a, b, angle): tmp = 0 if math.fabs(b) <= 1.72e+111: tmp = 0.011111111111111112 * ((angle * ((math.fabs(b) - a) * (math.fabs(b) + a))) * math.pi) else: tmp = (a + math.fabs(b)) * (0.011111111111111112 * ((angle * math.fabs(b)) * math.pi)) return tmp
function code(a, b, angle) tmp = 0.0 if (abs(b) <= 1.72e+111) tmp = Float64(0.011111111111111112 * Float64(Float64(angle * Float64(Float64(abs(b) - a) * Float64(abs(b) + a))) * pi)); else tmp = Float64(Float64(a + abs(b)) * Float64(0.011111111111111112 * Float64(Float64(angle * abs(b)) * pi))); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (abs(b) <= 1.72e+111) tmp = 0.011111111111111112 * ((angle * ((abs(b) - a) * (abs(b) + a))) * pi); else tmp = (a + abs(b)) * (0.011111111111111112 * ((angle * abs(b)) * pi)); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[N[Abs[b], $MachinePrecision], 1.72e+111], N[(0.011111111111111112 * N[(N[(angle * N[(N[(N[Abs[b], $MachinePrecision] - a), $MachinePrecision] * N[(N[Abs[b], $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision], N[(N[(a + N[Abs[b], $MachinePrecision]), $MachinePrecision] * N[(0.011111111111111112 * N[(N[(angle * N[Abs[b], $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left|b\right| \leq 1.72 \cdot 10^{+111}:\\
\;\;\;\;0.011111111111111112 \cdot \left(\left(angle \cdot \left(\left(\left|b\right| - a\right) \cdot \left(\left|b\right| + a\right)\right)\right) \cdot \pi\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a + \left|b\right|\right) \cdot \left(0.011111111111111112 \cdot \left(\left(angle \cdot \left|b\right|\right) \cdot \pi\right)\right)\\
\end{array}
if b < 1.72000000000000003e111Initial program 54.4%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
lower--.f64N/A
lower-pow.f64N/A
lower-pow.f6451.3%
Applied rewrites51.3%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6451.4%
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squares-revN/A
+-commutativeN/A
lift-+.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f6454.7%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6454.7%
Applied rewrites54.7%
if 1.72000000000000003e111 < b Initial program 54.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squaresN/A
lift-sin.f64N/A
lift-cos.f64N/A
Applied rewrites66.8%
Taylor expanded in a around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6441.8%
Applied rewrites41.8%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6440.3%
Applied rewrites40.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6440.3%
Applied rewrites40.3%
(FPCore (a b angle) :precision binary64 (* (+ (fabs a) (fabs b)) (* 0.011111111111111112 (* angle (* (fabs b) PI)))))
double code(double a, double b, double angle) {
return (fabs(a) + fabs(b)) * (0.011111111111111112 * (angle * (fabs(b) * ((double) M_PI))));
}
public static double code(double a, double b, double angle) {
return (Math.abs(a) + Math.abs(b)) * (0.011111111111111112 * (angle * (Math.abs(b) * Math.PI)));
}
def code(a, b, angle): return (math.fabs(a) + math.fabs(b)) * (0.011111111111111112 * (angle * (math.fabs(b) * math.pi)))
function code(a, b, angle) return Float64(Float64(abs(a) + abs(b)) * Float64(0.011111111111111112 * Float64(angle * Float64(abs(b) * pi)))) end
function tmp = code(a, b, angle) tmp = (abs(a) + abs(b)) * (0.011111111111111112 * (angle * (abs(b) * pi))); end
code[a_, b_, angle_] := N[(N[(N[Abs[a], $MachinePrecision] + N[Abs[b], $MachinePrecision]), $MachinePrecision] * N[(0.011111111111111112 * N[(angle * N[(N[Abs[b], $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\left|a\right| + \left|b\right|\right) \cdot \left(0.011111111111111112 \cdot \left(angle \cdot \left(\left|b\right| \cdot \pi\right)\right)\right)
Initial program 54.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squaresN/A
lift-sin.f64N/A
lift-cos.f64N/A
Applied rewrites66.8%
Taylor expanded in a around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6441.8%
Applied rewrites41.8%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6440.3%
Applied rewrites40.3%
(FPCore (a b angle) :precision binary64 (* b (* 0.011111111111111112 (* angle (* b PI)))))
double code(double a, double b, double angle) {
return b * (0.011111111111111112 * (angle * (b * ((double) M_PI))));
}
public static double code(double a, double b, double angle) {
return b * (0.011111111111111112 * (angle * (b * Math.PI)));
}
def code(a, b, angle): return b * (0.011111111111111112 * (angle * (b * math.pi)))
function code(a, b, angle) return Float64(b * Float64(0.011111111111111112 * Float64(angle * Float64(b * pi)))) end
function tmp = code(a, b, angle) tmp = b * (0.011111111111111112 * (angle * (b * pi))); end
code[a_, b_, angle_] := N[(b * N[(0.011111111111111112 * N[(angle * N[(b * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
b \cdot \left(0.011111111111111112 \cdot \left(angle \cdot \left(b \cdot \pi\right)\right)\right)
Initial program 54.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift--.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
difference-of-squaresN/A
lift-sin.f64N/A
lift-cos.f64N/A
Applied rewrites66.8%
Taylor expanded in a around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6441.8%
Applied rewrites41.8%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6440.3%
Applied rewrites40.3%
Taylor expanded in a around 0
Applied rewrites38.6%
herbie shell --seed 2025189
(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)))))