
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* (/ angle 180.0) PI))) (+ (pow (* a (sin t_0)) 2.0) (pow (* b (cos t_0)) 2.0))))
double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * ((double) M_PI);
return pow((a * sin(t_0)), 2.0) + pow((b * cos(t_0)), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * Math.PI;
return Math.pow((a * Math.sin(t_0)), 2.0) + Math.pow((b * Math.cos(t_0)), 2.0);
}
def code(a, b, angle): t_0 = (angle / 180.0) * math.pi return math.pow((a * math.sin(t_0)), 2.0) + math.pow((b * math.cos(t_0)), 2.0)
function code(a, b, angle) t_0 = Float64(Float64(angle / 180.0) * pi) return Float64((Float64(a * sin(t_0)) ^ 2.0) + (Float64(b * cos(t_0)) ^ 2.0)) end
function tmp = code(a, b, angle) t_0 = (angle / 180.0) * pi; tmp = ((a * sin(t_0)) ^ 2.0) + ((b * cos(t_0)) ^ 2.0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
{\left(a \cdot \sin t\_0\right)}^{2} + {\left(b \cdot \cos t\_0\right)}^{2}
\end{array}
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* (/ angle 180.0) PI))) (+ (pow (* a (sin t_0)) 2.0) (pow (* b (cos t_0)) 2.0))))
double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * ((double) M_PI);
return pow((a * sin(t_0)), 2.0) + pow((b * cos(t_0)), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * Math.PI;
return Math.pow((a * Math.sin(t_0)), 2.0) + Math.pow((b * Math.cos(t_0)), 2.0);
}
def code(a, b, angle): t_0 = (angle / 180.0) * math.pi return math.pow((a * math.sin(t_0)), 2.0) + math.pow((b * math.cos(t_0)), 2.0)
function code(a, b, angle) t_0 = Float64(Float64(angle / 180.0) * pi) return Float64((Float64(a * sin(t_0)) ^ 2.0) + (Float64(b * cos(t_0)) ^ 2.0)) end
function tmp = code(a, b, angle) t_0 = (angle / 180.0) * pi; tmp = ((a * sin(t_0)) ^ 2.0) + ((b * cos(t_0)) ^ 2.0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
{\left(a \cdot \sin t\_0\right)}^{2} + {\left(b \cdot \cos t\_0\right)}^{2}
\end{array}
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* (sin (* (* 0.005555555555555556 PI) angle)) a)))
(+
(/ (pow t_0 1.0) (pow t_0 -1.0))
(pow (* b (cos (* (/ angle 180.0) PI))) 2.0))))double code(double a, double b, double angle) {
double t_0 = sin(((0.005555555555555556 * ((double) M_PI)) * angle)) * a;
return (pow(t_0, 1.0) / pow(t_0, -1.0)) + pow((b * cos(((angle / 180.0) * ((double) M_PI)))), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.sin(((0.005555555555555556 * Math.PI) * angle)) * a;
return (Math.pow(t_0, 1.0) / Math.pow(t_0, -1.0)) + Math.pow((b * Math.cos(((angle / 180.0) * Math.PI))), 2.0);
}
def code(a, b, angle): t_0 = math.sin(((0.005555555555555556 * math.pi) * angle)) * a return (math.pow(t_0, 1.0) / math.pow(t_0, -1.0)) + math.pow((b * math.cos(((angle / 180.0) * math.pi))), 2.0)
function code(a, b, angle) t_0 = Float64(sin(Float64(Float64(0.005555555555555556 * pi) * angle)) * a) return Float64(Float64((t_0 ^ 1.0) / (t_0 ^ -1.0)) + (Float64(b * cos(Float64(Float64(angle / 180.0) * pi))) ^ 2.0)) end
function tmp = code(a, b, angle) t_0 = sin(((0.005555555555555556 * pi) * angle)) * a; tmp = ((t_0 ^ 1.0) / (t_0 ^ -1.0)) + ((b * cos(((angle / 180.0) * pi))) ^ 2.0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[Sin[N[(N[(0.005555555555555556 * Pi), $MachinePrecision] * angle), $MachinePrecision]], $MachinePrecision] * a), $MachinePrecision]}, N[(N[(N[Power[t$95$0, 1.0], $MachinePrecision] / N[Power[t$95$0, -1.0], $MachinePrecision]), $MachinePrecision] + N[Power[N[(b * N[Cos[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := \sin \left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\right) \cdot a\\
\frac{{t\_0}^{1}}{{t\_0}^{-1}} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}
\end{array}
Initial program 79.6%
lift-pow.f64N/A
metadata-evalN/A
pow-subN/A
lower-unsound-/.f64N/A
lower-unsound-pow.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
lower-unsound-pow.f6478.3
Applied rewrites79.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6477.9
Applied rewrites77.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6479.6
Applied rewrites79.6%
(FPCore (a b angle)
:precision binary64
(+
(fabs
(/
(* (sin (/ (* PI 0.005555555555555556) (* -1.0 (/ 1.0 angle)))) a)
(/ 1.0 (* a (sin (* (* angle 0.005555555555555556) PI))))))
(pow (* b (cos (* (/ angle 180.0) PI))) 2.0)))double code(double a, double b, double angle) {
return fabs(((sin(((((double) M_PI) * 0.005555555555555556) / (-1.0 * (1.0 / angle)))) * a) / (1.0 / (a * sin(((angle * 0.005555555555555556) * ((double) M_PI))))))) + pow((b * cos(((angle / 180.0) * ((double) M_PI)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.abs(((Math.sin(((Math.PI * 0.005555555555555556) / (-1.0 * (1.0 / angle)))) * a) / (1.0 / (a * Math.sin(((angle * 0.005555555555555556) * Math.PI)))))) + Math.pow((b * Math.cos(((angle / 180.0) * Math.PI))), 2.0);
}
def code(a, b, angle): return math.fabs(((math.sin(((math.pi * 0.005555555555555556) / (-1.0 * (1.0 / angle)))) * a) / (1.0 / (a * math.sin(((angle * 0.005555555555555556) * math.pi)))))) + math.pow((b * math.cos(((angle / 180.0) * math.pi))), 2.0)
function code(a, b, angle) return Float64(abs(Float64(Float64(sin(Float64(Float64(pi * 0.005555555555555556) / Float64(-1.0 * Float64(1.0 / angle)))) * a) / Float64(1.0 / Float64(a * sin(Float64(Float64(angle * 0.005555555555555556) * pi)))))) + (Float64(b * cos(Float64(Float64(angle / 180.0) * pi))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = abs(((sin(((pi * 0.005555555555555556) / (-1.0 * (1.0 / angle)))) * a) / (1.0 / (a * sin(((angle * 0.005555555555555556) * pi)))))) + ((b * cos(((angle / 180.0) * pi))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Abs[N[(N[(N[Sin[N[(N[(Pi * 0.005555555555555556), $MachinePrecision] / N[(-1.0 * N[(1.0 / angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * a), $MachinePrecision] / N[(1.0 / N[(a * N[Sin[N[(N[(angle * 0.005555555555555556), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\left|\frac{\sin \left(\frac{\pi \cdot 0.005555555555555556}{-1 \cdot \frac{1}{angle}}\right) \cdot a}{\frac{1}{a \cdot \sin \left(\left(angle \cdot 0.005555555555555556\right) \cdot \pi\right)}}\right| + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}
Initial program 79.6%
lift-pow.f64N/A
metadata-evalN/A
pow-subN/A
lower-unsound-/.f64N/A
lower-unsound-pow.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
lower-unsound-pow.f6478.3
Applied rewrites79.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6477.9
Applied rewrites77.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6479.6
Applied rewrites79.6%
Applied rewrites79.5%
lift-/.f64N/A
metadata-evalN/A
distribute-neg-frac2N/A
div-flip-revN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l/N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
div-flip-revN/A
lift-/.f64N/A
associate-/r/N/A
lift-PI.f64N/A
lift-/.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
*-lft-identityN/A
distribute-lft-neg-inN/A
metadata-evalN/A
metadata-evalN/A
lift-*.f64N/A
lift-/.f64N/A
lift-PI.f64N/A
lift-PI.f64N/A
Applied rewrites79.6%
(FPCore (a b angle) :precision binary64 (+ (pow (/ 1.0 (* a (sin (* (* angle 0.005555555555555556) PI)))) -2.0) (pow (* b (sin (fma (* PI -0.005555555555555556) angle (* PI 0.5)))) 2.0)))
double code(double a, double b, double angle) {
return pow((1.0 / (a * sin(((angle * 0.005555555555555556) * ((double) M_PI))))), -2.0) + pow((b * sin(fma((((double) M_PI) * -0.005555555555555556), angle, (((double) M_PI) * 0.5)))), 2.0);
}
function code(a, b, angle) return Float64((Float64(1.0 / Float64(a * sin(Float64(Float64(angle * 0.005555555555555556) * pi)))) ^ -2.0) + (Float64(b * sin(fma(Float64(pi * -0.005555555555555556), angle, Float64(pi * 0.5)))) ^ 2.0)) end
code[a_, b_, angle_] := N[(N[Power[N[(1.0 / N[(a * N[Sin[N[(N[(angle * 0.005555555555555556), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(N[(Pi * -0.005555555555555556), $MachinePrecision] * angle + N[(Pi * 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
{\left(\frac{1}{a \cdot \sin \left(\left(angle \cdot 0.005555555555555556\right) \cdot \pi\right)}\right)}^{-2} + {\left(b \cdot \sin \left(\mathsf{fma}\left(\pi \cdot -0.005555555555555556, angle, \pi \cdot 0.5\right)\right)\right)}^{2}
Initial program 79.6%
lift-pow.f64N/A
metadata-evalN/A
pow-subN/A
lower-unsound-/.f64N/A
lower-unsound-pow.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
lower-unsound-pow.f6478.3
Applied rewrites79.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6477.9
Applied rewrites77.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6479.6
Applied rewrites79.6%
lift-/.f64N/A
lift-pow.f64N/A
unpow1N/A
mult-flipN/A
remove-double-divN/A
unpow-1N/A
lift-pow.f64N/A
inv-powN/A
inv-powN/A
pow-prod-upN/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
Applied rewrites79.6%
lift-cos.f64N/A
cos-neg-revN/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-PI.f64N/A
lift-PI.f64N/A
associate-*l/N/A
lift-*.f64N/A
distribute-neg-frac2N/A
metadata-evalN/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
mult-flipN/A
lower-*.f64N/A
metadata-evalN/A
lift-PI.f64N/A
mult-flipN/A
metadata-evalN/A
lower-*.f6479.6
Applied rewrites79.6%
(FPCore (a b angle) :precision binary64 (+ (pow (/ 1.0 (* a (sin (* (* PI 0.005555555555555556) angle)))) -2.0) (pow (* b (cos (* (/ angle 180.0) PI))) 2.0)))
double code(double a, double b, double angle) {
return pow((1.0 / (a * sin(((((double) M_PI) * 0.005555555555555556) * angle)))), -2.0) + pow((b * cos(((angle / 180.0) * ((double) M_PI)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((1.0 / (a * Math.sin(((Math.PI * 0.005555555555555556) * angle)))), -2.0) + Math.pow((b * Math.cos(((angle / 180.0) * Math.PI))), 2.0);
}
def code(a, b, angle): return math.pow((1.0 / (a * math.sin(((math.pi * 0.005555555555555556) * angle)))), -2.0) + math.pow((b * math.cos(((angle / 180.0) * math.pi))), 2.0)
function code(a, b, angle) return Float64((Float64(1.0 / Float64(a * sin(Float64(Float64(pi * 0.005555555555555556) * angle)))) ^ -2.0) + (Float64(b * cos(Float64(Float64(angle / 180.0) * pi))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((1.0 / (a * sin(((pi * 0.005555555555555556) * angle)))) ^ -2.0) + ((b * cos(((angle / 180.0) * pi))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(1.0 / N[(a * N[Sin[N[(N[(Pi * 0.005555555555555556), $MachinePrecision] * angle), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
{\left(\frac{1}{a \cdot \sin \left(\left(\pi \cdot 0.005555555555555556\right) \cdot angle\right)}\right)}^{-2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}
Initial program 79.6%
lift-pow.f64N/A
metadata-evalN/A
pow-subN/A
lower-unsound-/.f64N/A
lower-unsound-pow.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
lower-unsound-pow.f6478.3
Applied rewrites79.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6477.9
Applied rewrites77.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6479.6
Applied rewrites79.6%
lift-/.f64N/A
lift-pow.f64N/A
unpow1N/A
mult-flipN/A
remove-double-divN/A
unpow-1N/A
lift-pow.f64N/A
inv-powN/A
inv-powN/A
pow-prod-upN/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
Applied rewrites79.6%
lift-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
mult-flipN/A
lift-PI.f64N/A
lift-PI.f64N/A
associate-/r/N/A
lift-/.f64N/A
div-flip-revN/A
associate-/r/N/A
lower-*.f64N/A
lift-/.f64N/A
associate-/r/N/A
metadata-evalN/A
*-commutativeN/A
lower-*.f6479.6
Applied rewrites79.6%
(FPCore (a b angle) :precision binary64 (+ (pow (/ 1.0 (* a (sin (* (* angle 0.005555555555555556) PI)))) -2.0) (pow (* b (cos (* (/ angle 180.0) PI))) 2.0)))
double code(double a, double b, double angle) {
return pow((1.0 / (a * sin(((angle * 0.005555555555555556) * ((double) M_PI))))), -2.0) + pow((b * cos(((angle / 180.0) * ((double) M_PI)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((1.0 / (a * Math.sin(((angle * 0.005555555555555556) * Math.PI)))), -2.0) + Math.pow((b * Math.cos(((angle / 180.0) * Math.PI))), 2.0);
}
def code(a, b, angle): return math.pow((1.0 / (a * math.sin(((angle * 0.005555555555555556) * math.pi)))), -2.0) + math.pow((b * math.cos(((angle / 180.0) * math.pi))), 2.0)
function code(a, b, angle) return Float64((Float64(1.0 / Float64(a * sin(Float64(Float64(angle * 0.005555555555555556) * pi)))) ^ -2.0) + (Float64(b * cos(Float64(Float64(angle / 180.0) * pi))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((1.0 / (a * sin(((angle * 0.005555555555555556) * pi)))) ^ -2.0) + ((b * cos(((angle / 180.0) * pi))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(1.0 / N[(a * N[Sin[N[(N[(angle * 0.005555555555555556), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
{\left(\frac{1}{a \cdot \sin \left(\left(angle \cdot 0.005555555555555556\right) \cdot \pi\right)}\right)}^{-2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}
Initial program 79.6%
lift-pow.f64N/A
metadata-evalN/A
pow-subN/A
lower-unsound-/.f64N/A
lower-unsound-pow.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
lower-unsound-pow.f6478.3
Applied rewrites79.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6477.9
Applied rewrites77.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6479.6
Applied rewrites79.6%
lift-/.f64N/A
lift-pow.f64N/A
unpow1N/A
mult-flipN/A
remove-double-divN/A
unpow-1N/A
lift-pow.f64N/A
inv-powN/A
inv-powN/A
pow-prod-upN/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
Applied rewrites79.6%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* (/ (fabs angle) 180.0) PI))) 2.0) (pow (* b (sin (* PI (fma 0.005555555555555556 (fabs angle) 0.5)))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin(((fabs(angle) / 180.0) * ((double) M_PI)))), 2.0) + pow((b * sin((((double) M_PI) * fma(0.005555555555555556, fabs(angle), 0.5)))), 2.0);
}
function code(a, b, angle) return Float64((Float64(a * sin(Float64(Float64(abs(angle) / 180.0) * pi))) ^ 2.0) + (Float64(b * sin(Float64(pi * fma(0.005555555555555556, abs(angle), 0.5)))) ^ 2.0)) end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(N[(N[Abs[angle], $MachinePrecision] / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(Pi * N[(0.005555555555555556 * N[Abs[angle], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
{\left(a \cdot \sin \left(\frac{\left|angle\right|}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \mathsf{fma}\left(0.005555555555555556, \left|angle\right|, 0.5\right)\right)\right)}^{2}
Initial program 79.6%
lift-cos.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-PI.f64N/A
mult-flipN/A
distribute-lft-outN/A
lower-*.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
metadata-evalN/A
metadata-eval79.6
Applied rewrites79.6%
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* (* 0.005555555555555556 PI) angle))) (+ (pow (* a (sin t_0)) 2.0) (pow (* b (cos t_0)) 2.0))))
double code(double a, double b, double angle) {
double t_0 = (0.005555555555555556 * ((double) M_PI)) * angle;
return pow((a * sin(t_0)), 2.0) + pow((b * cos(t_0)), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = (0.005555555555555556 * Math.PI) * angle;
return Math.pow((a * Math.sin(t_0)), 2.0) + Math.pow((b * Math.cos(t_0)), 2.0);
}
def code(a, b, angle): t_0 = (0.005555555555555556 * math.pi) * angle return math.pow((a * math.sin(t_0)), 2.0) + math.pow((b * math.cos(t_0)), 2.0)
function code(a, b, angle) t_0 = Float64(Float64(0.005555555555555556 * pi) * angle) return Float64((Float64(a * sin(t_0)) ^ 2.0) + (Float64(b * cos(t_0)) ^ 2.0)) end
function tmp = code(a, b, angle) t_0 = (0.005555555555555556 * pi) * angle; tmp = ((a * sin(t_0)) ^ 2.0) + ((b * cos(t_0)) ^ 2.0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[(0.005555555555555556 * Pi), $MachinePrecision] * angle), $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := \left(0.005555555555555556 \cdot \pi\right) \cdot angle\\
{\left(a \cdot \sin t\_0\right)}^{2} + {\left(b \cdot \cos t\_0\right)}^{2}
\end{array}
Initial program 79.6%
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
metadata-eval79.6
Applied rewrites79.6%
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
metadata-eval79.7
Applied rewrites79.7%
(FPCore (a b angle) :precision binary64 (+ (pow (/ 1.0 (* a (sin (* (* angle 0.005555555555555556) PI)))) -2.0) (pow (* b 1.0) 2.0)))
double code(double a, double b, double angle) {
return pow((1.0 / (a * sin(((angle * 0.005555555555555556) * ((double) M_PI))))), -2.0) + pow((b * 1.0), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((1.0 / (a * Math.sin(((angle * 0.005555555555555556) * Math.PI)))), -2.0) + Math.pow((b * 1.0), 2.0);
}
def code(a, b, angle): return math.pow((1.0 / (a * math.sin(((angle * 0.005555555555555556) * math.pi)))), -2.0) + math.pow((b * 1.0), 2.0)
function code(a, b, angle) return Float64((Float64(1.0 / Float64(a * sin(Float64(Float64(angle * 0.005555555555555556) * pi)))) ^ -2.0) + (Float64(b * 1.0) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((1.0 / (a * sin(((angle * 0.005555555555555556) * pi)))) ^ -2.0) + ((b * 1.0) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(1.0 / N[(a * N[Sin[N[(N[(angle * 0.005555555555555556), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision] + N[Power[N[(b * 1.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
{\left(\frac{1}{a \cdot \sin \left(\left(angle \cdot 0.005555555555555556\right) \cdot \pi\right)}\right)}^{-2} + {\left(b \cdot 1\right)}^{2}
Initial program 79.6%
lift-pow.f64N/A
metadata-evalN/A
pow-subN/A
lower-unsound-/.f64N/A
lower-unsound-pow.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
lower-unsound-pow.f6478.3
Applied rewrites79.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6477.9
Applied rewrites77.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6479.6
Applied rewrites79.6%
lift-/.f64N/A
lift-pow.f64N/A
unpow1N/A
mult-flipN/A
remove-double-divN/A
unpow-1N/A
lift-pow.f64N/A
inv-powN/A
inv-powN/A
pow-prod-upN/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
Applied rewrites79.6%
Taylor expanded in angle around 0
Applied rewrites79.5%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* (/ angle 180.0) PI))) 2.0) (pow (* b 1.0) 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin(((angle / 180.0) * ((double) M_PI)))), 2.0) + pow((b * 1.0), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin(((angle / 180.0) * Math.PI))), 2.0) + Math.pow((b * 1.0), 2.0);
}
def code(a, b, angle): return math.pow((a * math.sin(((angle / 180.0) * math.pi))), 2.0) + math.pow((b * 1.0), 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + (Float64(b * 1.0) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin(((angle / 180.0) * pi))) ^ 2.0) + ((b * 1.0) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * 1.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot 1\right)}^{2}
Initial program 79.6%
Taylor expanded in angle around 0
Applied rewrites79.5%
(FPCore (a b angle) :precision binary64 (if (<= (fabs b) 1.1e-158) (* (pow a 2.0) (- 0.5 (* 0.5 (cos (* 0.011111111111111112 (* angle PI)))))) (* (fabs b) (fabs b))))
double code(double a, double b, double angle) {
double tmp;
if (fabs(b) <= 1.1e-158) {
tmp = pow(a, 2.0) * (0.5 - (0.5 * cos((0.011111111111111112 * (angle * ((double) M_PI))))));
} else {
tmp = fabs(b) * fabs(b);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (Math.abs(b) <= 1.1e-158) {
tmp = Math.pow(a, 2.0) * (0.5 - (0.5 * Math.cos((0.011111111111111112 * (angle * Math.PI)))));
} else {
tmp = Math.abs(b) * Math.abs(b);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if math.fabs(b) <= 1.1e-158: tmp = math.pow(a, 2.0) * (0.5 - (0.5 * math.cos((0.011111111111111112 * (angle * math.pi))))) else: tmp = math.fabs(b) * math.fabs(b) return tmp
function code(a, b, angle) tmp = 0.0 if (abs(b) <= 1.1e-158) tmp = Float64((a ^ 2.0) * Float64(0.5 - Float64(0.5 * cos(Float64(0.011111111111111112 * Float64(angle * pi)))))); else tmp = Float64(abs(b) * abs(b)); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (abs(b) <= 1.1e-158) tmp = (a ^ 2.0) * (0.5 - (0.5 * cos((0.011111111111111112 * (angle * pi))))); else tmp = abs(b) * abs(b); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[N[Abs[b], $MachinePrecision], 1.1e-158], N[(N[Power[a, 2.0], $MachinePrecision] * N[(0.5 - N[(0.5 * N[Cos[N[(0.011111111111111112 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Abs[b], $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left|b\right| \leq 1.1 \cdot 10^{-158}:\\
\;\;\;\;{a}^{2} \cdot \left(0.5 - 0.5 \cdot \cos \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left|b\right| \cdot \left|b\right|\\
\end{array}
if b < 1.1000000000000001e-158Initial program 79.6%
Applied rewrites62.6%
Taylor expanded in a around inf
lower-*.f64N/A
lower-pow.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6426.4
Applied rewrites26.4%
if 1.1000000000000001e-158 < b Initial program 79.6%
Taylor expanded in angle around 0
lower-pow.f6456.6
Applied rewrites56.6%
lift-pow.f64N/A
unpow2N/A
lower-*.f6456.6
Applied rewrites56.6%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* (/ angle 180.0) PI)))
(if (<= (+ (pow (* a (sin t_0)) 2.0) (pow (* b (cos t_0)) 2.0)) 2e+296)
(* b b)
(sqrt (sqrt (pow b 8.0))))))double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * ((double) M_PI);
double tmp;
if ((pow((a * sin(t_0)), 2.0) + pow((b * cos(t_0)), 2.0)) <= 2e+296) {
tmp = b * b;
} else {
tmp = sqrt(sqrt(pow(b, 8.0)));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * Math.PI;
double tmp;
if ((Math.pow((a * Math.sin(t_0)), 2.0) + Math.pow((b * Math.cos(t_0)), 2.0)) <= 2e+296) {
tmp = b * b;
} else {
tmp = Math.sqrt(Math.sqrt(Math.pow(b, 8.0)));
}
return tmp;
}
def code(a, b, angle): t_0 = (angle / 180.0) * math.pi tmp = 0 if (math.pow((a * math.sin(t_0)), 2.0) + math.pow((b * math.cos(t_0)), 2.0)) <= 2e+296: tmp = b * b else: tmp = math.sqrt(math.sqrt(math.pow(b, 8.0))) return tmp
function code(a, b, angle) t_0 = Float64(Float64(angle / 180.0) * pi) tmp = 0.0 if (Float64((Float64(a * sin(t_0)) ^ 2.0) + (Float64(b * cos(t_0)) ^ 2.0)) <= 2e+296) tmp = Float64(b * b); else tmp = sqrt(sqrt((b ^ 8.0))); end return tmp end
function tmp_2 = code(a, b, angle) t_0 = (angle / 180.0) * pi; tmp = 0.0; if ((((a * sin(t_0)) ^ 2.0) + ((b * cos(t_0)) ^ 2.0)) <= 2e+296) tmp = b * b; else tmp = sqrt(sqrt((b ^ 8.0))); end tmp_2 = tmp; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, If[LessEqual[N[(N[Power[N[(a * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], 2e+296], N[(b * b), $MachinePrecision], N[Sqrt[N[Sqrt[N[Power[b, 8.0], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
\mathbf{if}\;{\left(a \cdot \sin t\_0\right)}^{2} + {\left(b \cdot \cos t\_0\right)}^{2} \leq 2 \cdot 10^{+296}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\sqrt{{b}^{8}}}\\
\end{array}
if (+.f64 (pow.f64 (*.f64 a (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64))) < 1.99999999999999996e296Initial program 79.6%
Taylor expanded in angle around 0
lower-pow.f6456.6
Applied rewrites56.6%
lift-pow.f64N/A
unpow2N/A
lower-*.f6456.6
Applied rewrites56.6%
if 1.99999999999999996e296 < (+.f64 (pow.f64 (*.f64 a (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64))) Initial program 79.6%
Taylor expanded in angle around 0
lower-pow.f6456.6
Applied rewrites56.6%
lift-pow.f64N/A
unpow2N/A
lower-*.f6456.6
Applied rewrites56.6%
rem-square-sqrtN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6449.4
Applied rewrites49.4%
rem-square-sqrtN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
pow2N/A
lift-*.f64N/A
pow-prod-downN/A
pow-prod-upN/A
lift-*.f64N/A
pow-prod-downN/A
pow-prod-upN/A
lower-pow.f64N/A
metadata-evalN/A
metadata-evalN/A
metadata-eval45.1
Applied rewrites45.1%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* (fabs b) (fabs b))) (t_1 (* (/ angle 180.0) PI)))
(if (<=
(+ (pow (* a (sin t_1)) 2.0) (pow (* (fabs b) (cos t_1)) 2.0))
2e+296)
t_0
(* (sqrt (* t_0 (fabs b))) (sqrt (fabs b))))))double code(double a, double b, double angle) {
double t_0 = fabs(b) * fabs(b);
double t_1 = (angle / 180.0) * ((double) M_PI);
double tmp;
if ((pow((a * sin(t_1)), 2.0) + pow((fabs(b) * cos(t_1)), 2.0)) <= 2e+296) {
tmp = t_0;
} else {
tmp = sqrt((t_0 * fabs(b))) * sqrt(fabs(b));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = Math.abs(b) * Math.abs(b);
double t_1 = (angle / 180.0) * Math.PI;
double tmp;
if ((Math.pow((a * Math.sin(t_1)), 2.0) + Math.pow((Math.abs(b) * Math.cos(t_1)), 2.0)) <= 2e+296) {
tmp = t_0;
} else {
tmp = Math.sqrt((t_0 * Math.abs(b))) * Math.sqrt(Math.abs(b));
}
return tmp;
}
def code(a, b, angle): t_0 = math.fabs(b) * math.fabs(b) t_1 = (angle / 180.0) * math.pi tmp = 0 if (math.pow((a * math.sin(t_1)), 2.0) + math.pow((math.fabs(b) * math.cos(t_1)), 2.0)) <= 2e+296: tmp = t_0 else: tmp = math.sqrt((t_0 * math.fabs(b))) * math.sqrt(math.fabs(b)) return tmp
function code(a, b, angle) t_0 = Float64(abs(b) * abs(b)) t_1 = Float64(Float64(angle / 180.0) * pi) tmp = 0.0 if (Float64((Float64(a * sin(t_1)) ^ 2.0) + (Float64(abs(b) * cos(t_1)) ^ 2.0)) <= 2e+296) tmp = t_0; else tmp = Float64(sqrt(Float64(t_0 * abs(b))) * sqrt(abs(b))); end return tmp end
function tmp_2 = code(a, b, angle) t_0 = abs(b) * abs(b); t_1 = (angle / 180.0) * pi; tmp = 0.0; if ((((a * sin(t_1)) ^ 2.0) + ((abs(b) * cos(t_1)) ^ 2.0)) <= 2e+296) tmp = t_0; else tmp = sqrt((t_0 * abs(b))) * sqrt(abs(b)); end tmp_2 = tmp; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[Abs[b], $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, If[LessEqual[N[(N[Power[N[(a * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(N[Abs[b], $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], 2e+296], t$95$0, N[(N[Sqrt[N[(t$95$0 * N[Abs[b], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[Abs[b], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \left|b\right| \cdot \left|b\right|\\
t_1 := \frac{angle}{180} \cdot \pi\\
\mathbf{if}\;{\left(a \cdot \sin t\_1\right)}^{2} + {\left(\left|b\right| \cdot \cos t\_1\right)}^{2} \leq 2 \cdot 10^{+296}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\sqrt{t\_0 \cdot \left|b\right|} \cdot \sqrt{\left|b\right|}\\
\end{array}
if (+.f64 (pow.f64 (*.f64 a (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64))) < 1.99999999999999996e296Initial program 79.6%
Taylor expanded in angle around 0
lower-pow.f6456.6
Applied rewrites56.6%
lift-pow.f64N/A
unpow2N/A
lower-*.f6456.6
Applied rewrites56.6%
if 1.99999999999999996e296 < (+.f64 (pow.f64 (*.f64 a (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64))) Initial program 79.6%
Taylor expanded in angle around 0
lower-pow.f6456.6
Applied rewrites56.6%
lift-pow.f64N/A
unpow2N/A
lower-*.f6456.6
Applied rewrites56.6%
rem-square-sqrtN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6449.4
Applied rewrites49.4%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
sqrt-prodN/A
lower-unsound-*.f64N/A
lower-unsound-sqrt.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-unsound-sqrt.f6426.4
Applied rewrites26.4%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* (/ angle 180.0) PI)))
(if (<= (+ (pow (* a (sin t_0)) 2.0) (pow (* b (cos t_0)) 2.0)) 2e+296)
(* b b)
(sqrt (* (* b b) (* b b))))))double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * ((double) M_PI);
double tmp;
if ((pow((a * sin(t_0)), 2.0) + pow((b * cos(t_0)), 2.0)) <= 2e+296) {
tmp = b * b;
} else {
tmp = sqrt(((b * b) * (b * b)));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * Math.PI;
double tmp;
if ((Math.pow((a * Math.sin(t_0)), 2.0) + Math.pow((b * Math.cos(t_0)), 2.0)) <= 2e+296) {
tmp = b * b;
} else {
tmp = Math.sqrt(((b * b) * (b * b)));
}
return tmp;
}
def code(a, b, angle): t_0 = (angle / 180.0) * math.pi tmp = 0 if (math.pow((a * math.sin(t_0)), 2.0) + math.pow((b * math.cos(t_0)), 2.0)) <= 2e+296: tmp = b * b else: tmp = math.sqrt(((b * b) * (b * b))) return tmp
function code(a, b, angle) t_0 = Float64(Float64(angle / 180.0) * pi) tmp = 0.0 if (Float64((Float64(a * sin(t_0)) ^ 2.0) + (Float64(b * cos(t_0)) ^ 2.0)) <= 2e+296) tmp = Float64(b * b); else tmp = sqrt(Float64(Float64(b * b) * Float64(b * b))); end return tmp end
function tmp_2 = code(a, b, angle) t_0 = (angle / 180.0) * pi; tmp = 0.0; if ((((a * sin(t_0)) ^ 2.0) + ((b * cos(t_0)) ^ 2.0)) <= 2e+296) tmp = b * b; else tmp = sqrt(((b * b) * (b * b))); end tmp_2 = tmp; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, If[LessEqual[N[(N[Power[N[(a * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], 2e+296], N[(b * b), $MachinePrecision], N[Sqrt[N[(N[(b * b), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
\mathbf{if}\;{\left(a \cdot \sin t\_0\right)}^{2} + {\left(b \cdot \cos t\_0\right)}^{2} \leq 2 \cdot 10^{+296}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\left(b \cdot b\right) \cdot \left(b \cdot b\right)}\\
\end{array}
if (+.f64 (pow.f64 (*.f64 a (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64))) < 1.99999999999999996e296Initial program 79.6%
Taylor expanded in angle around 0
lower-pow.f6456.6
Applied rewrites56.6%
lift-pow.f64N/A
unpow2N/A
lower-*.f6456.6
Applied rewrites56.6%
if 1.99999999999999996e296 < (+.f64 (pow.f64 (*.f64 a (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64))) Initial program 79.6%
Taylor expanded in angle around 0
lower-pow.f6456.6
Applied rewrites56.6%
lift-pow.f64N/A
unpow2N/A
lower-*.f6456.6
Applied rewrites56.6%
rem-square-sqrtN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6449.4
Applied rewrites49.4%
(FPCore (a b angle) :precision binary64 (* b b))
double code(double a, double b, double angle) {
return b * b;
}
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 = b * b
end function
public static double code(double a, double b, double angle) {
return b * b;
}
def code(a, b, angle): return b * b
function code(a, b, angle) return Float64(b * b) end
function tmp = code(a, b, angle) tmp = b * b; end
code[a_, b_, angle_] := N[(b * b), $MachinePrecision]
b \cdot b
Initial program 79.6%
Taylor expanded in angle around 0
lower-pow.f6456.6
Applied rewrites56.6%
lift-pow.f64N/A
unpow2N/A
lower-*.f6456.6
Applied rewrites56.6%
herbie shell --seed 2025173
(FPCore (a b angle)
:name "ab-angle->ABCF A"
:precision binary64
(+ (pow (* a (sin (* (/ angle 180.0) PI))) 2.0) (pow (* b (cos (* (/ angle 180.0) PI))) 2.0)))