
(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 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (/ angle 180.0)))) (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin t_0)) (cos t_0))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle / 180.0);
return ((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * sin(t_0)) * cos(t_0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (angle / 180.0);
return ((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * Math.sin(t_0)) * Math.cos(t_0);
}
def code(a, b, angle): t_0 = math.pi * (angle / 180.0) return ((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * math.sin(t_0)) * math.cos(t_0)
function code(a, b, angle) t_0 = Float64(pi * Float64(angle / 180.0)) return Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * sin(t_0)) * cos(t_0)) end
function tmp = code(a, b, angle) t_0 = pi * (angle / 180.0); tmp = ((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * sin(t_0)) * cos(t_0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
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
(let* ((t_0 (* (fabs angle) PI)) (t_1 (- (fabs b) a)))
(*
(copysign 1.0 angle)
(if (<= (fabs angle) 2e+222)
(*
(* (cos (/ 1.0 (/ -180.0 t_0))) (+ (fabs b) a))
(* (sin (/ t_0 180.0)) (* 2.0 t_1)))
(*
(* t_1 (+ a (fabs b)))
(sin (* (* 0.011111111111111112 (fabs angle)) PI)))))))double code(double a, double b, double angle) {
double t_0 = fabs(angle) * ((double) M_PI);
double t_1 = fabs(b) - a;
double tmp;
if (fabs(angle) <= 2e+222) {
tmp = (cos((1.0 / (-180.0 / t_0))) * (fabs(b) + a)) * (sin((t_0 / 180.0)) * (2.0 * t_1));
} else {
tmp = (t_1 * (a + fabs(b))) * sin(((0.011111111111111112 * fabs(angle)) * ((double) M_PI)));
}
return copysign(1.0, angle) * tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = Math.abs(angle) * Math.PI;
double t_1 = Math.abs(b) - a;
double tmp;
if (Math.abs(angle) <= 2e+222) {
tmp = (Math.cos((1.0 / (-180.0 / t_0))) * (Math.abs(b) + a)) * (Math.sin((t_0 / 180.0)) * (2.0 * t_1));
} else {
tmp = (t_1 * (a + Math.abs(b))) * Math.sin(((0.011111111111111112 * Math.abs(angle)) * Math.PI));
}
return Math.copySign(1.0, angle) * tmp;
}
def code(a, b, angle): t_0 = math.fabs(angle) * math.pi t_1 = math.fabs(b) - a tmp = 0 if math.fabs(angle) <= 2e+222: tmp = (math.cos((1.0 / (-180.0 / t_0))) * (math.fabs(b) + a)) * (math.sin((t_0 / 180.0)) * (2.0 * t_1)) else: tmp = (t_1 * (a + math.fabs(b))) * math.sin(((0.011111111111111112 * math.fabs(angle)) * math.pi)) return math.copysign(1.0, angle) * tmp
function code(a, b, angle) t_0 = Float64(abs(angle) * pi) t_1 = Float64(abs(b) - a) tmp = 0.0 if (abs(angle) <= 2e+222) tmp = Float64(Float64(cos(Float64(1.0 / Float64(-180.0 / t_0))) * Float64(abs(b) + a)) * Float64(sin(Float64(t_0 / 180.0)) * Float64(2.0 * t_1))); else tmp = Float64(Float64(t_1 * Float64(a + abs(b))) * sin(Float64(Float64(0.011111111111111112 * abs(angle)) * pi))); end return Float64(copysign(1.0, angle) * tmp) end
function tmp_2 = code(a, b, angle) t_0 = abs(angle) * pi; t_1 = abs(b) - a; tmp = 0.0; if (abs(angle) <= 2e+222) tmp = (cos((1.0 / (-180.0 / t_0))) * (abs(b) + a)) * (sin((t_0 / 180.0)) * (2.0 * t_1)); else tmp = (t_1 * (a + abs(b))) * sin(((0.011111111111111112 * abs(angle)) * pi)); end tmp_2 = (sign(angle) * abs(1.0)) * tmp; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[Abs[angle], $MachinePrecision] * Pi), $MachinePrecision]}, Block[{t$95$1 = N[(N[Abs[b], $MachinePrecision] - a), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[angle], $MachinePrecision], 2e+222], N[(N[(N[Cos[N[(1.0 / N[(-180.0 / t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Abs[b], $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision] * N[(N[Sin[N[(t$95$0 / 180.0), $MachinePrecision]], $MachinePrecision] * N[(2.0 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 * N[(a + N[Abs[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(N[(0.011111111111111112 * N[Abs[angle], $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left|angle\right| \cdot \pi\\
t_1 := \left|b\right| - a\\
\mathsf{copysign}\left(1, angle\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|angle\right| \leq 2 \cdot 10^{+222}:\\
\;\;\;\;\left(\cos \left(\frac{1}{\frac{-180}{t\_0}}\right) \cdot \left(\left|b\right| + a\right)\right) \cdot \left(\sin \left(\frac{t\_0}{180}\right) \cdot \left(2 \cdot t\_1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 \cdot \left(a + \left|b\right|\right)\right) \cdot \sin \left(\left(0.011111111111111112 \cdot \left|angle\right|\right) \cdot \pi\right)\\
\end{array}
\end{array}
if angle < 2.0000000000000001e222Initial program 54.1%
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--.f6458.0%
Applied rewrites58.0%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites67.4%
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flip-revN/A
lower-/.f6467.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f6467.3%
Applied rewrites67.3%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
metadata-evalN/A
metadata-evalN/A
mult-flip-revN/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
metadata-eval67.3%
Applied rewrites67.3%
if 2.0000000000000001e222 < angle Initial program 54.1%
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.9%
lift-*.f64N/A
*-commutativeN/A
lift-PI.f64N/A
add-cube-cbrtN/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-*.f64N/A
lift-PI.f64N/A
lower-cbrt.f6457.6%
Applied rewrites57.6%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
lift-cbrt.f64N/A
pow1/3N/A
pow-prod-upN/A
metadata-evalN/A
unpow1N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6458.1%
Applied rewrites58.1%
(FPCore (a b angle) :precision binary64 (* (* (cos (* (* PI angle) -0.005555555555555556)) (+ (fabs b) a)) (* (sin (/ (* angle PI) 180.0)) (* 2.0 (- (fabs b) a)))))
double code(double a, double b, double angle) {
return (cos(((((double) M_PI) * angle) * -0.005555555555555556)) * (fabs(b) + a)) * (sin(((angle * ((double) M_PI)) / 180.0)) * (2.0 * (fabs(b) - a)));
}
public static double code(double a, double b, double angle) {
return (Math.cos(((Math.PI * angle) * -0.005555555555555556)) * (Math.abs(b) + a)) * (Math.sin(((angle * Math.PI) / 180.0)) * (2.0 * (Math.abs(b) - a)));
}
def code(a, b, angle): return (math.cos(((math.pi * angle) * -0.005555555555555556)) * (math.fabs(b) + a)) * (math.sin(((angle * math.pi) / 180.0)) * (2.0 * (math.fabs(b) - a)))
function code(a, b, angle) return Float64(Float64(cos(Float64(Float64(pi * angle) * -0.005555555555555556)) * Float64(abs(b) + a)) * Float64(sin(Float64(Float64(angle * pi) / 180.0)) * Float64(2.0 * Float64(abs(b) - a)))) end
function tmp = code(a, b, angle) tmp = (cos(((pi * angle) * -0.005555555555555556)) * (abs(b) + a)) * (sin(((angle * pi) / 180.0)) * (2.0 * (abs(b) - a))); end
code[a_, b_, angle_] := N[(N[(N[Cos[N[(N[(Pi * angle), $MachinePrecision] * -0.005555555555555556), $MachinePrecision]], $MachinePrecision] * N[(N[Abs[b], $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision] * N[(N[Sin[N[(N[(angle * Pi), $MachinePrecision] / 180.0), $MachinePrecision]], $MachinePrecision] * N[(2.0 * N[(N[Abs[b], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\cos \left(\left(\pi \cdot angle\right) \cdot -0.005555555555555556\right) \cdot \left(\left|b\right| + a\right)\right) \cdot \left(\sin \left(\frac{angle \cdot \pi}{180}\right) \cdot \left(2 \cdot \left(\left|b\right| - a\right)\right)\right)
Initial program 54.1%
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--.f6458.0%
Applied rewrites58.0%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites67.4%
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flip-revN/A
lower-/.f6467.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f6467.3%
Applied rewrites67.3%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (- (fabs b) a)) (t_1 (+ a (fabs b))))
(*
(copysign 1.0 angle)
(if (<= (fabs angle) 5e+183)
(*
t_1
(*
t_0
(sin
(*
(* (pow PI 0.6666666666666666) (* (cbrt PI) (fabs angle)))
0.011111111111111112))))
(* (* t_0 t_1) (sin (* (* 0.011111111111111112 (fabs angle)) PI)))))))double code(double a, double b, double angle) {
double t_0 = fabs(b) - a;
double t_1 = a + fabs(b);
double tmp;
if (fabs(angle) <= 5e+183) {
tmp = t_1 * (t_0 * sin(((pow(((double) M_PI), 0.6666666666666666) * (cbrt(((double) M_PI)) * fabs(angle))) * 0.011111111111111112)));
} else {
tmp = (t_0 * t_1) * sin(((0.011111111111111112 * fabs(angle)) * ((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) - a;
double t_1 = a + Math.abs(b);
double tmp;
if (Math.abs(angle) <= 5e+183) {
tmp = t_1 * (t_0 * Math.sin(((Math.pow(Math.PI, 0.6666666666666666) * (Math.cbrt(Math.PI) * Math.abs(angle))) * 0.011111111111111112)));
} else {
tmp = (t_0 * t_1) * Math.sin(((0.011111111111111112 * Math.abs(angle)) * Math.PI));
}
return Math.copySign(1.0, angle) * tmp;
}
function code(a, b, angle) t_0 = Float64(abs(b) - a) t_1 = Float64(a + abs(b)) tmp = 0.0 if (abs(angle) <= 5e+183) tmp = Float64(t_1 * Float64(t_0 * sin(Float64(Float64((pi ^ 0.6666666666666666) * Float64(cbrt(pi) * abs(angle))) * 0.011111111111111112)))); else tmp = Float64(Float64(t_0 * t_1) * sin(Float64(Float64(0.011111111111111112 * abs(angle)) * pi))); end return Float64(copysign(1.0, angle) * tmp) end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[Abs[b], $MachinePrecision] - a), $MachinePrecision]}, Block[{t$95$1 = N[(a + N[Abs[b], $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], 5e+183], N[(t$95$1 * N[(t$95$0 * N[Sin[N[(N[(N[Power[Pi, 0.6666666666666666], $MachinePrecision] * N[(N[Power[Pi, 1/3], $MachinePrecision] * N[Abs[angle], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * t$95$1), $MachinePrecision] * N[Sin[N[(N[(0.011111111111111112 * N[Abs[angle], $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left|b\right| - a\\
t_1 := a + \left|b\right|\\
\mathsf{copysign}\left(1, angle\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|angle\right| \leq 5 \cdot 10^{+183}:\\
\;\;\;\;t\_1 \cdot \left(t\_0 \cdot \sin \left(\left({\pi}^{0.6666666666666666} \cdot \left(\sqrt[3]{\pi} \cdot \left|angle\right|\right)\right) \cdot 0.011111111111111112\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 \cdot t\_1\right) \cdot \sin \left(\left(0.011111111111111112 \cdot \left|angle\right|\right) \cdot \pi\right)\\
\end{array}
\end{array}
if angle < 5.0000000000000001e183Initial program 54.1%
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 rewrites67.4%
lift-*.f64N/A
*-commutativeN/A
lift-PI.f64N/A
add-cube-cbrtN/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-*.f64N/A
lift-PI.f64N/A
lower-cbrt.f6467.0%
Applied rewrites67.0%
if 5.0000000000000001e183 < angle Initial program 54.1%
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.9%
lift-*.f64N/A
*-commutativeN/A
lift-PI.f64N/A
add-cube-cbrtN/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-*.f64N/A
lift-PI.f64N/A
lower-cbrt.f6457.6%
Applied rewrites57.6%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
lift-cbrt.f64N/A
pow1/3N/A
pow-prod-upN/A
metadata-evalN/A
unpow1N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6458.1%
Applied rewrites58.1%
(FPCore (a b angle) :precision binary64 (* (* (cos (* (* PI angle) -0.005555555555555556)) (+ (fabs b) a)) (* (sin (* (* 0.005555555555555556 PI) angle)) (* 2.0 (- (fabs b) a)))))
double code(double a, double b, double angle) {
return (cos(((((double) M_PI) * angle) * -0.005555555555555556)) * (fabs(b) + a)) * (sin(((0.005555555555555556 * ((double) M_PI)) * angle)) * (2.0 * (fabs(b) - a)));
}
public static double code(double a, double b, double angle) {
return (Math.cos(((Math.PI * angle) * -0.005555555555555556)) * (Math.abs(b) + a)) * (Math.sin(((0.005555555555555556 * Math.PI) * angle)) * (2.0 * (Math.abs(b) - a)));
}
def code(a, b, angle): return (math.cos(((math.pi * angle) * -0.005555555555555556)) * (math.fabs(b) + a)) * (math.sin(((0.005555555555555556 * math.pi) * angle)) * (2.0 * (math.fabs(b) - a)))
function code(a, b, angle) return Float64(Float64(cos(Float64(Float64(pi * angle) * -0.005555555555555556)) * Float64(abs(b) + a)) * Float64(sin(Float64(Float64(0.005555555555555556 * pi) * angle)) * Float64(2.0 * Float64(abs(b) - a)))) end
function tmp = code(a, b, angle) tmp = (cos(((pi * angle) * -0.005555555555555556)) * (abs(b) + a)) * (sin(((0.005555555555555556 * pi) * angle)) * (2.0 * (abs(b) - a))); end
code[a_, b_, angle_] := N[(N[(N[Cos[N[(N[(Pi * angle), $MachinePrecision] * -0.005555555555555556), $MachinePrecision]], $MachinePrecision] * N[(N[Abs[b], $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision] * N[(N[Sin[N[(N[(0.005555555555555556 * Pi), $MachinePrecision] * angle), $MachinePrecision]], $MachinePrecision] * N[(2.0 * N[(N[Abs[b], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\cos \left(\left(\pi \cdot angle\right) \cdot -0.005555555555555556\right) \cdot \left(\left|b\right| + a\right)\right) \cdot \left(\sin \left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\right) \cdot \left(2 \cdot \left(\left|b\right| - a\right)\right)\right)
Initial program 54.1%
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--.f6458.0%
Applied rewrites58.0%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites67.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6467.2%
Applied rewrites67.2%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (- (fabs b) a)) (t_1 (+ a (fabs b))))
(*
(copysign 1.0 angle)
(if (<= (fabs angle) 2e-9)
(* t_1 (* 0.03490658503988659 (* (fabs angle) t_0)))
(* (* t_1 t_0) (sin (* 0.03490658503988659 (fabs angle))))))))double code(double a, double b, double angle) {
double t_0 = fabs(b) - a;
double t_1 = a + fabs(b);
double tmp;
if (fabs(angle) <= 2e-9) {
tmp = t_1 * (0.03490658503988659 * (fabs(angle) * t_0));
} else {
tmp = (t_1 * t_0) * sin((0.03490658503988659 * fabs(angle)));
}
return copysign(1.0, angle) * tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = Math.abs(b) - a;
double t_1 = a + Math.abs(b);
double tmp;
if (Math.abs(angle) <= 2e-9) {
tmp = t_1 * (0.03490658503988659 * (Math.abs(angle) * t_0));
} else {
tmp = (t_1 * t_0) * Math.sin((0.03490658503988659 * Math.abs(angle)));
}
return Math.copySign(1.0, angle) * tmp;
}
def code(a, b, angle): t_0 = math.fabs(b) - a t_1 = a + math.fabs(b) tmp = 0 if math.fabs(angle) <= 2e-9: tmp = t_1 * (0.03490658503988659 * (math.fabs(angle) * t_0)) else: tmp = (t_1 * t_0) * math.sin((0.03490658503988659 * math.fabs(angle))) return math.copysign(1.0, angle) * tmp
function code(a, b, angle) t_0 = Float64(abs(b) - a) t_1 = Float64(a + abs(b)) tmp = 0.0 if (abs(angle) <= 2e-9) tmp = Float64(t_1 * Float64(0.03490658503988659 * Float64(abs(angle) * t_0))); else tmp = Float64(Float64(t_1 * t_0) * sin(Float64(0.03490658503988659 * abs(angle)))); end return Float64(copysign(1.0, angle) * tmp) end
function tmp_2 = code(a, b, angle) t_0 = abs(b) - a; t_1 = a + abs(b); tmp = 0.0; if (abs(angle) <= 2e-9) tmp = t_1 * (0.03490658503988659 * (abs(angle) * t_0)); else tmp = (t_1 * t_0) * sin((0.03490658503988659 * abs(angle))); end tmp_2 = (sign(angle) * abs(1.0)) * tmp; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[Abs[b], $MachinePrecision] - a), $MachinePrecision]}, Block[{t$95$1 = N[(a + N[Abs[b], $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], 2e-9], N[(t$95$1 * N[(0.03490658503988659 * N[(N[Abs[angle], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 * t$95$0), $MachinePrecision] * N[Sin[N[(0.03490658503988659 * N[Abs[angle], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left|b\right| - a\\
t_1 := a + \left|b\right|\\
\mathsf{copysign}\left(1, angle\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|angle\right| \leq 2 \cdot 10^{-9}:\\
\;\;\;\;t\_1 \cdot \left(0.03490658503988659 \cdot \left(\left|angle\right| \cdot t\_0\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 \cdot t\_0\right) \cdot \sin \left(0.03490658503988659 \cdot \left|angle\right|\right)\\
\end{array}
\end{array}
if angle < 2.0000000000000001e-9Initial program 54.1%
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 rewrites67.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6467.2%
Applied rewrites67.2%
Evaluated real constant67.2%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower--.f6462.4%
Applied rewrites62.4%
if 2.0000000000000001e-9 < angle Initial program 54.1%
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 rewrites67.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6467.2%
Applied rewrites67.2%
Evaluated real constant67.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift--.f64N/A
difference-of-squares-revN/A
unpow2N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
unpow2N/A
difference-of-squares-revN/A
+-commutativeN/A
lift-+.f64N/A
lift--.f64N/A
lower-*.f6457.8%
Applied rewrites57.8%
(FPCore (a b angle) :precision binary64 (* (+ a (fabs b)) (* (- (fabs b) a) (sin (* 0.03490658503988659 angle)))))
double code(double a, double b, double angle) {
return (a + fabs(b)) * ((fabs(b) - a) * sin((0.03490658503988659 * angle)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, b, angle)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
code = (a + abs(b)) * ((abs(b) - a) * sin((0.03490658503988659d0 * angle)))
end function
public static double code(double a, double b, double angle) {
return (a + Math.abs(b)) * ((Math.abs(b) - a) * Math.sin((0.03490658503988659 * angle)));
}
def code(a, b, angle): return (a + math.fabs(b)) * ((math.fabs(b) - a) * math.sin((0.03490658503988659 * angle)))
function code(a, b, angle) return Float64(Float64(a + abs(b)) * Float64(Float64(abs(b) - a) * sin(Float64(0.03490658503988659 * angle)))) end
function tmp = code(a, b, angle) tmp = (a + abs(b)) * ((abs(b) - a) * sin((0.03490658503988659 * angle))); end
code[a_, b_, angle_] := N[(N[(a + N[Abs[b], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Abs[b], $MachinePrecision] - a), $MachinePrecision] * N[Sin[N[(0.03490658503988659 * angle), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(a + \left|b\right|\right) \cdot \left(\left(\left|b\right| - a\right) \cdot \sin \left(0.03490658503988659 \cdot angle\right)\right)
Initial program 54.1%
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 rewrites67.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6467.2%
Applied rewrites67.2%
Evaluated real constant67.2%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (- (fabs b) (fabs a))) (t_1 (+ (fabs a) (fabs b))))
(if (<= (fabs a) 5.5e-173)
(* t_1 (* (fabs b) (sin (* 0.03490658503988659 angle))))
(if (<= (fabs a) 1.1e+227)
(* t_1 (* 0.03490658503988659 (* angle t_0)))
(*
t_1
(*
t_0
(*
angle
(+
0.03490658503988659
(* -7.088769245610384e-6 (pow angle 2.0))))))))))double code(double a, double b, double angle) {
double t_0 = fabs(b) - fabs(a);
double t_1 = fabs(a) + fabs(b);
double tmp;
if (fabs(a) <= 5.5e-173) {
tmp = t_1 * (fabs(b) * sin((0.03490658503988659 * angle)));
} else if (fabs(a) <= 1.1e+227) {
tmp = t_1 * (0.03490658503988659 * (angle * t_0));
} else {
tmp = t_1 * (t_0 * (angle * (0.03490658503988659 + (-7.088769245610384e-6 * pow(angle, 2.0)))));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, b, angle)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = abs(b) - abs(a)
t_1 = abs(a) + abs(b)
if (abs(a) <= 5.5d-173) then
tmp = t_1 * (abs(b) * sin((0.03490658503988659d0 * angle)))
else if (abs(a) <= 1.1d+227) then
tmp = t_1 * (0.03490658503988659d0 * (angle * t_0))
else
tmp = t_1 * (t_0 * (angle * (0.03490658503988659d0 + ((-7.088769245610384d-6) * (angle ** 2.0d0)))))
end if
code = tmp
end function
public static double code(double a, double b, double angle) {
double t_0 = Math.abs(b) - Math.abs(a);
double t_1 = Math.abs(a) + Math.abs(b);
double tmp;
if (Math.abs(a) <= 5.5e-173) {
tmp = t_1 * (Math.abs(b) * Math.sin((0.03490658503988659 * angle)));
} else if (Math.abs(a) <= 1.1e+227) {
tmp = t_1 * (0.03490658503988659 * (angle * t_0));
} else {
tmp = t_1 * (t_0 * (angle * (0.03490658503988659 + (-7.088769245610384e-6 * Math.pow(angle, 2.0)))));
}
return tmp;
}
def code(a, b, angle): t_0 = math.fabs(b) - math.fabs(a) t_1 = math.fabs(a) + math.fabs(b) tmp = 0 if math.fabs(a) <= 5.5e-173: tmp = t_1 * (math.fabs(b) * math.sin((0.03490658503988659 * angle))) elif math.fabs(a) <= 1.1e+227: tmp = t_1 * (0.03490658503988659 * (angle * t_0)) else: tmp = t_1 * (t_0 * (angle * (0.03490658503988659 + (-7.088769245610384e-6 * math.pow(angle, 2.0))))) return tmp
function code(a, b, angle) t_0 = Float64(abs(b) - abs(a)) t_1 = Float64(abs(a) + abs(b)) tmp = 0.0 if (abs(a) <= 5.5e-173) tmp = Float64(t_1 * Float64(abs(b) * sin(Float64(0.03490658503988659 * angle)))); elseif (abs(a) <= 1.1e+227) tmp = Float64(t_1 * Float64(0.03490658503988659 * Float64(angle * t_0))); else tmp = Float64(t_1 * Float64(t_0 * Float64(angle * Float64(0.03490658503988659 + Float64(-7.088769245610384e-6 * (angle ^ 2.0)))))); end return tmp end
function tmp_2 = code(a, b, angle) t_0 = abs(b) - abs(a); t_1 = abs(a) + abs(b); tmp = 0.0; if (abs(a) <= 5.5e-173) tmp = t_1 * (abs(b) * sin((0.03490658503988659 * angle))); elseif (abs(a) <= 1.1e+227) tmp = t_1 * (0.03490658503988659 * (angle * t_0)); else tmp = t_1 * (t_0 * (angle * (0.03490658503988659 + (-7.088769245610384e-6 * (angle ^ 2.0))))); end tmp_2 = tmp; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[Abs[b], $MachinePrecision] - N[Abs[a], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Abs[a], $MachinePrecision] + N[Abs[b], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[a], $MachinePrecision], 5.5e-173], N[(t$95$1 * N[(N[Abs[b], $MachinePrecision] * N[Sin[N[(0.03490658503988659 * angle), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[a], $MachinePrecision], 1.1e+227], N[(t$95$1 * N[(0.03490658503988659 * N[(angle * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(t$95$0 * N[(angle * N[(0.03490658503988659 + N[(-7.088769245610384e-6 * N[Power[angle, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \left|b\right| - \left|a\right|\\
t_1 := \left|a\right| + \left|b\right|\\
\mathbf{if}\;\left|a\right| \leq 5.5 \cdot 10^{-173}:\\
\;\;\;\;t\_1 \cdot \left(\left|b\right| \cdot \sin \left(0.03490658503988659 \cdot angle\right)\right)\\
\mathbf{elif}\;\left|a\right| \leq 1.1 \cdot 10^{+227}:\\
\;\;\;\;t\_1 \cdot \left(0.03490658503988659 \cdot \left(angle \cdot t\_0\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(t\_0 \cdot \left(angle \cdot \left(0.03490658503988659 + -7.088769245610384 \cdot 10^{-6} \cdot {angle}^{2}\right)\right)\right)\\
\end{array}
if a < 5.5000000000000002e-173Initial program 54.1%
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 rewrites67.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6467.2%
Applied rewrites67.2%
Evaluated real constant67.2%
Taylor expanded in a around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f6441.4%
Applied rewrites41.4%
if 5.5000000000000002e-173 < a < 1.1000000000000001e227Initial program 54.1%
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 rewrites67.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6467.2%
Applied rewrites67.2%
Evaluated real constant67.2%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower--.f6462.4%
Applied rewrites62.4%
if 1.1000000000000001e227 < a Initial program 54.1%
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 rewrites67.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6467.2%
Applied rewrites67.2%
Evaluated real constant67.2%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6461.2%
Applied rewrites61.2%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (- (fabs b) (fabs a))))
(*
(copysign 1.0 angle)
(if (<= (fabs angle) 7200000000000.0)
(*
(+ (fabs a) (fabs b))
(*
(fabs angle)
(fma
-7.088769245610384e-6
(* (pow (fabs angle) 2.0) t_0)
(* 0.03490658503988659 t_0))))
(*
0.011111111111111112
(* (fabs angle) (log (exp (* (* PI t_0) (+ (fabs b) (fabs a)))))))))))double code(double a, double b, double angle) {
double t_0 = fabs(b) - fabs(a);
double tmp;
if (fabs(angle) <= 7200000000000.0) {
tmp = (fabs(a) + fabs(b)) * (fabs(angle) * fma(-7.088769245610384e-6, (pow(fabs(angle), 2.0) * t_0), (0.03490658503988659 * t_0)));
} else {
tmp = 0.011111111111111112 * (fabs(angle) * log(exp(((((double) M_PI) * t_0) * (fabs(b) + fabs(a))))));
}
return copysign(1.0, angle) * tmp;
}
function code(a, b, angle) t_0 = Float64(abs(b) - abs(a)) tmp = 0.0 if (abs(angle) <= 7200000000000.0) tmp = Float64(Float64(abs(a) + abs(b)) * Float64(abs(angle) * fma(-7.088769245610384e-6, Float64((abs(angle) ^ 2.0) * t_0), Float64(0.03490658503988659 * t_0)))); else tmp = Float64(0.011111111111111112 * Float64(abs(angle) * log(exp(Float64(Float64(pi * t_0) * Float64(abs(b) + abs(a))))))); end return Float64(copysign(1.0, angle) * 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], 7200000000000.0], N[(N[(N[Abs[a], $MachinePrecision] + N[Abs[b], $MachinePrecision]), $MachinePrecision] * N[(N[Abs[angle], $MachinePrecision] * N[(-7.088769245610384e-6 * N[(N[Power[N[Abs[angle], $MachinePrecision], 2.0], $MachinePrecision] * t$95$0), $MachinePrecision] + N[(0.03490658503988659 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.011111111111111112 * N[(N[Abs[angle], $MachinePrecision] * N[Log[N[Exp[N[(N[(Pi * t$95$0), $MachinePrecision] * N[(N[Abs[b], $MachinePrecision] + N[Abs[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $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 7200000000000:\\
\;\;\;\;\left(\left|a\right| + \left|b\right|\right) \cdot \left(\left|angle\right| \cdot \mathsf{fma}\left(-7.088769245610384 \cdot 10^{-6}, {\left(\left|angle\right|\right)}^{2} \cdot t\_0, 0.03490658503988659 \cdot t\_0\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.011111111111111112 \cdot \left(\left|angle\right| \cdot \log \left(e^{\left(\pi \cdot t\_0\right) \cdot \left(\left|b\right| + \left|a\right|\right)}\right)\right)\\
\end{array}
\end{array}
if angle < 7.2e12Initial program 54.1%
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 rewrites67.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6467.2%
Applied rewrites67.2%
Evaluated real constant67.2%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f6461.2%
Applied rewrites61.2%
if 7.2e12 < angle Initial program 54.1%
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 rewrites67.4%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6454.5%
Applied rewrites54.5%
lift-*.f64N/A
*-commutativeN/A
lift-PI.f64N/A
add-log-expN/A
log-pow-revN/A
lower-log.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift--.f64N/A
difference-of-squares-revN/A
unpow2N/A
unpow2N/A
pow-expN/A
lower-*.f64N/A
unpow2N/A
unpow2N/A
difference-of-squares-revN/A
+-commutativeN/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
Applied rewrites35.3%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (- (fabs b) a)))
(*
(copysign 1.0 angle)
(if (<= (fabs angle) 7200000000000.0)
(*
(+ a (fabs b))
(*
t_0
(*
(fabs angle)
(+
0.03490658503988659
(* -7.088769245610384e-6 (pow (fabs angle) 2.0))))))
(*
0.011111111111111112
(* (fabs angle) (log (exp (* (* PI t_0) (+ (fabs b) a))))))))))double code(double a, double b, double angle) {
double t_0 = fabs(b) - a;
double tmp;
if (fabs(angle) <= 7200000000000.0) {
tmp = (a + fabs(b)) * (t_0 * (fabs(angle) * (0.03490658503988659 + (-7.088769245610384e-6 * pow(fabs(angle), 2.0)))));
} else {
tmp = 0.011111111111111112 * (fabs(angle) * log(exp(((((double) M_PI) * t_0) * (fabs(b) + a)))));
}
return copysign(1.0, angle) * tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = Math.abs(b) - a;
double tmp;
if (Math.abs(angle) <= 7200000000000.0) {
tmp = (a + Math.abs(b)) * (t_0 * (Math.abs(angle) * (0.03490658503988659 + (-7.088769245610384e-6 * Math.pow(Math.abs(angle), 2.0)))));
} else {
tmp = 0.011111111111111112 * (Math.abs(angle) * Math.log(Math.exp(((Math.PI * t_0) * (Math.abs(b) + a)))));
}
return Math.copySign(1.0, angle) * tmp;
}
def code(a, b, angle): t_0 = math.fabs(b) - a tmp = 0 if math.fabs(angle) <= 7200000000000.0: tmp = (a + math.fabs(b)) * (t_0 * (math.fabs(angle) * (0.03490658503988659 + (-7.088769245610384e-6 * math.pow(math.fabs(angle), 2.0))))) else: tmp = 0.011111111111111112 * (math.fabs(angle) * math.log(math.exp(((math.pi * t_0) * (math.fabs(b) + a))))) return math.copysign(1.0, angle) * tmp
function code(a, b, angle) t_0 = Float64(abs(b) - a) tmp = 0.0 if (abs(angle) <= 7200000000000.0) tmp = Float64(Float64(a + abs(b)) * Float64(t_0 * Float64(abs(angle) * Float64(0.03490658503988659 + Float64(-7.088769245610384e-6 * (abs(angle) ^ 2.0)))))); else tmp = Float64(0.011111111111111112 * Float64(abs(angle) * log(exp(Float64(Float64(pi * t_0) * Float64(abs(b) + a)))))); end return Float64(copysign(1.0, angle) * tmp) end
function tmp_2 = code(a, b, angle) t_0 = abs(b) - a; tmp = 0.0; if (abs(angle) <= 7200000000000.0) tmp = (a + abs(b)) * (t_0 * (abs(angle) * (0.03490658503988659 + (-7.088769245610384e-6 * (abs(angle) ^ 2.0))))); else tmp = 0.011111111111111112 * (abs(angle) * log(exp(((pi * t_0) * (abs(b) + a))))); end tmp_2 = (sign(angle) * abs(1.0)) * tmp; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[Abs[b], $MachinePrecision] - a), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[angle], $MachinePrecision], 7200000000000.0], N[(N[(a + N[Abs[b], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(N[Abs[angle], $MachinePrecision] * N[(0.03490658503988659 + N[(-7.088769245610384e-6 * N[Power[N[Abs[angle], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.011111111111111112 * N[(N[Abs[angle], $MachinePrecision] * N[Log[N[Exp[N[(N[(Pi * t$95$0), $MachinePrecision] * N[(N[Abs[b], $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
t_0 := \left|b\right| - a\\
\mathsf{copysign}\left(1, angle\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|angle\right| \leq 7200000000000:\\
\;\;\;\;\left(a + \left|b\right|\right) \cdot \left(t\_0 \cdot \left(\left|angle\right| \cdot \left(0.03490658503988659 + -7.088769245610384 \cdot 10^{-6} \cdot {\left(\left|angle\right|\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.011111111111111112 \cdot \left(\left|angle\right| \cdot \log \left(e^{\left(\pi \cdot t\_0\right) \cdot \left(\left|b\right| + a\right)}\right)\right)\\
\end{array}
\end{array}
if angle < 7.2e12Initial program 54.1%
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 rewrites67.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6467.2%
Applied rewrites67.2%
Evaluated real constant67.2%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6461.2%
Applied rewrites61.2%
if 7.2e12 < angle Initial program 54.1%
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 rewrites67.4%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6454.5%
Applied rewrites54.5%
lift-*.f64N/A
*-commutativeN/A
lift-PI.f64N/A
add-log-expN/A
log-pow-revN/A
lower-log.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift--.f64N/A
difference-of-squares-revN/A
unpow2N/A
unpow2N/A
pow-expN/A
lower-*.f64N/A
unpow2N/A
unpow2N/A
difference-of-squares-revN/A
+-commutativeN/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
Applied rewrites35.3%
(FPCore (a b angle) :precision binary64 (* (+ a (fabs b)) (* 0.03490658503988659 (* angle (- (fabs b) a)))))
double code(double a, double b, double angle) {
return (a + fabs(b)) * (0.03490658503988659 * (angle * (fabs(b) - a)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, b, angle)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
code = (a + abs(b)) * (0.03490658503988659d0 * (angle * (abs(b) - a)))
end function
public static double code(double a, double b, double angle) {
return (a + Math.abs(b)) * (0.03490658503988659 * (angle * (Math.abs(b) - a)));
}
def code(a, b, angle): return (a + math.fabs(b)) * (0.03490658503988659 * (angle * (math.fabs(b) - a)))
function code(a, b, angle) return Float64(Float64(a + abs(b)) * Float64(0.03490658503988659 * Float64(angle * Float64(abs(b) - a)))) end
function tmp = code(a, b, angle) tmp = (a + abs(b)) * (0.03490658503988659 * (angle * (abs(b) - a))); end
code[a_, b_, angle_] := N[(N[(a + N[Abs[b], $MachinePrecision]), $MachinePrecision] * N[(0.03490658503988659 * N[(angle * N[(N[Abs[b], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(a + \left|b\right|\right) \cdot \left(0.03490658503988659 \cdot \left(angle \cdot \left(\left|b\right| - a\right)\right)\right)
Initial program 54.1%
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 rewrites67.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6467.2%
Applied rewrites67.2%
Evaluated real constant67.2%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower--.f6462.4%
Applied rewrites62.4%
(FPCore (a b angle) :precision binary64 (* 0.03490658503988659 (* angle (* (+ a b) (- b a)))))
double code(double a, double b, double angle) {
return 0.03490658503988659 * (angle * ((a + b) * (b - a)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, b, angle)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
code = 0.03490658503988659d0 * (angle * ((a + b) * (b - a)))
end function
public static double code(double a, double b, double angle) {
return 0.03490658503988659 * (angle * ((a + b) * (b - a)));
}
def code(a, b, angle): return 0.03490658503988659 * (angle * ((a + b) * (b - a)))
function code(a, b, angle) return Float64(0.03490658503988659 * Float64(angle * Float64(Float64(a + b) * Float64(b - a)))) end
function tmp = code(a, b, angle) tmp = 0.03490658503988659 * (angle * ((a + b) * (b - a))); end
code[a_, b_, angle_] := N[(0.03490658503988659 * N[(angle * N[(N[(a + b), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
0.03490658503988659 \cdot \left(angle \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\right)
Initial program 54.1%
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 rewrites67.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6467.2%
Applied rewrites67.2%
Evaluated real constant67.2%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6454.5%
Applied rewrites54.5%
herbie shell --seed 2025207
(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)))))