
(FPCore (a b angle) :precision binary64 :pre TRUE (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]]
f(a, b, angle): a in [-inf, +inf], b in [-inf, +inf], angle in [-inf, +inf] code: THEORY BEGIN f(a, b, angle: real): real = LET t_0 = ((angle / (180)) * (4 * atan(1))) IN ((a * (sin(t_0))) ^ (2)) + ((b * (cos(t_0))) ^ (2)) END code
\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 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b angle) :precision binary64 :pre TRUE (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]]
f(a, b, angle): a in [-inf, +inf], b in [-inf, +inf], angle in [-inf, +inf] code: THEORY BEGIN f(a, b, angle: real): real = LET t_0 = ((angle / (180)) * (4 * atan(1))) IN ((a * (sin(t_0))) ^ (2)) + ((b * (cos(t_0))) ^ (2)) END code
\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 :pre TRUE (+ (pow (* a (sin (/ 1.0 (pow (* PI (* 0.005555555555555556 angle)) -1.0)))) 2.0) (pow (* b (sin (* PI (fma 0.005555555555555556 angle 0.5)))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin((1.0 / pow((((double) M_PI) * (0.005555555555555556 * angle)), -1.0)))), 2.0) + pow((b * sin((((double) M_PI) * fma(0.005555555555555556, angle, 0.5)))), 2.0);
}
function code(a, b, angle) return Float64((Float64(a * sin(Float64(1.0 / (Float64(pi * Float64(0.005555555555555556 * angle)) ^ -1.0)))) ^ 2.0) + (Float64(b * sin(Float64(pi * fma(0.005555555555555556, angle, 0.5)))) ^ 2.0)) end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(1.0 / N[Power[N[(Pi * N[(0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(Pi * N[(0.005555555555555556 * angle + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
f(a, b, angle): a in [-inf, +inf], b in [-inf, +inf], angle in [-inf, +inf] code: THEORY BEGIN f(a, b, angle: real): real = ((a * (sin(((1) / (((4 * atan(1)) * ((5555555555555555767577313730498644872568547725677490234375e-60) * angle)) ^ (-1)))))) ^ (2)) + ((b * (sin(((4 * atan(1)) * (((5555555555555555767577313730498644872568547725677490234375e-60) * angle) + (5e-1)))))) ^ (2)) END code
{\left(a \cdot \sin \left(\frac{1}{{\left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)}^{-1}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \mathsf{fma}\left(0.005555555555555556, angle, 0.5\right)\right)\right)}^{2}
Initial program 79.0%
Applied rewrites79.1%
Applied rewrites79.0%
(FPCore (a b angle) :precision binary64 :pre TRUE (+ (pow (* a (sin (* (/ angle 180.0) PI))) 2.0) (pow (* b (sin (* PI (fma 0.005555555555555556 angle 0.5)))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin(((angle / 180.0) * ((double) M_PI)))), 2.0) + pow((b * sin((((double) M_PI) * fma(0.005555555555555556, angle, 0.5)))), 2.0);
}
function code(a, b, angle) return Float64((Float64(a * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + (Float64(b * sin(Float64(pi * fma(0.005555555555555556, angle, 0.5)))) ^ 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 * N[Sin[N[(Pi * N[(0.005555555555555556 * angle + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
f(a, b, angle): a in [-inf, +inf], b in [-inf, +inf], angle in [-inf, +inf] code: THEORY BEGIN f(a, b, angle: real): real = ((a * (sin(((angle / (180)) * (4 * atan(1)))))) ^ (2)) + ((b * (sin(((4 * atan(1)) * (((5555555555555555767577313730498644872568547725677490234375e-60) * angle) + (5e-1)))))) ^ (2)) END code
{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \mathsf{fma}\left(0.005555555555555556, angle, 0.5\right)\right)\right)}^{2}
Initial program 79.0%
Applied rewrites79.1%
(FPCore (a b angle) :precision binary64 :pre TRUE (+ (pow (* a (sin (* (/ angle 180.0) PI))) 2.0) (* b b)))
double code(double a, double b, double angle) {
return pow((a * sin(((angle / 180.0) * ((double) M_PI)))), 2.0) + (b * b);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin(((angle / 180.0) * Math.PI))), 2.0) + (b * b);
}
def code(a, b, angle): return math.pow((a * math.sin(((angle / 180.0) * math.pi))), 2.0) + (b * b)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + Float64(b * b)) end
function tmp = code(a, b, angle) tmp = ((a * sin(((angle / 180.0) * pi))) ^ 2.0) + (b * b); 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[(b * b), $MachinePrecision]), $MachinePrecision]
f(a, b, angle): a in [-inf, +inf], b in [-inf, +inf], angle in [-inf, +inf] code: THEORY BEGIN f(a, b, angle: real): real = ((a * (sin(((angle / (180)) * (4 * atan(1)))))) ^ (2)) + (b * b) END code
{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + b \cdot b
Initial program 79.0%
Taylor expanded in angle around 0
Applied rewrites79.0%
Applied rewrites79.0%
(FPCore (a b angle)
:precision binary64
:pre TRUE
(if (<= (fabs angle) 57.91029501410751)
(+
(pow (* 0.005555555555555556 (* a (* (fabs angle) PI))) 2.0)
(pow b 2.0))
(fma
(-
0.5
(*
0.5
(cos (* 2.0 (* PI (* 0.005555555555555556 (fabs angle)))))))
(* a a)
(* b b))))double code(double a, double b, double angle) {
double tmp;
if (fabs(angle) <= 57.91029501410751) {
tmp = pow((0.005555555555555556 * (a * (fabs(angle) * ((double) M_PI)))), 2.0) + pow(b, 2.0);
} else {
tmp = fma((0.5 - (0.5 * cos((2.0 * (((double) M_PI) * (0.005555555555555556 * fabs(angle))))))), (a * a), (b * b));
}
return tmp;
}
function code(a, b, angle) tmp = 0.0 if (abs(angle) <= 57.91029501410751) tmp = Float64((Float64(0.005555555555555556 * Float64(a * Float64(abs(angle) * pi))) ^ 2.0) + (b ^ 2.0)); else tmp = fma(Float64(0.5 - Float64(0.5 * cos(Float64(2.0 * Float64(pi * Float64(0.005555555555555556 * abs(angle))))))), Float64(a * a), Float64(b * b)); end return tmp end
code[a_, b_, angle_] := If[LessEqual[N[Abs[angle], $MachinePrecision], 57.91029501410751], N[(N[Power[N[(0.005555555555555556 * N[(a * N[(N[Abs[angle], $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision], N[(N[(0.5 - N[(0.5 * N[Cos[N[(2.0 * N[(Pi * N[(0.005555555555555556 * N[Abs[angle], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]]
f(a, b, angle): a in [-inf, +inf], b in [-inf, +inf], angle in [-inf, +inf] code: THEORY BEGIN f(a, b, angle: real): real = LET tmp = IF ((abs(angle)) <= (5791029501410751123557929531671106815338134765625e-47)) THEN ((((5555555555555555767577313730498644872568547725677490234375e-60) * (a * ((abs(angle)) * (4 * atan(1))))) ^ (2)) + (b ^ (2))) ELSE ((((5e-1) - ((5e-1) * (cos(((2) * ((4 * atan(1)) * ((5555555555555555767577313730498644872568547725677490234375e-60) * (abs(angle))))))))) * (a * a)) + (b * b)) ENDIF IN tmp END code
\begin{array}{l}
\mathbf{if}\;\left|angle\right| \leq 57.91029501410751:\\
\;\;\;\;{\left(0.005555555555555556 \cdot \left(a \cdot \left(\left|angle\right| \cdot \pi\right)\right)\right)}^{2} + {b}^{2}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(\pi \cdot \left(0.005555555555555556 \cdot \left|angle\right|\right)\right)\right), a \cdot a, b \cdot b\right)\\
\end{array}
if angle < 57.910295014107511Initial program 79.0%
Taylor expanded in angle around 0
Applied rewrites79.0%
Taylor expanded in angle around 0
Applied rewrites73.9%
if 57.910295014107511 < angle Initial program 79.0%
Taylor expanded in angle around 0
Applied rewrites79.0%
Applied rewrites61.6%
(FPCore (a b angle) :precision binary64 :pre TRUE (if (<= (fabs a) 1.678151993572926e+37) (* (- 0.5 (* 0.5 (cos (* 2.0 (* 0.5 PI))))) (* b b)) (+ (pow (* 0.005555555555555556 (* (fabs a) (* angle PI))) 2.0) (pow b 2.0))))
double code(double a, double b, double angle) {
double tmp;
if (fabs(a) <= 1.678151993572926e+37) {
tmp = (0.5 - (0.5 * cos((2.0 * (0.5 * ((double) M_PI)))))) * (b * b);
} else {
tmp = pow((0.005555555555555556 * (fabs(a) * (angle * ((double) M_PI)))), 2.0) + pow(b, 2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (Math.abs(a) <= 1.678151993572926e+37) {
tmp = (0.5 - (0.5 * Math.cos((2.0 * (0.5 * Math.PI))))) * (b * b);
} else {
tmp = Math.pow((0.005555555555555556 * (Math.abs(a) * (angle * Math.PI))), 2.0) + Math.pow(b, 2.0);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if math.fabs(a) <= 1.678151993572926e+37: tmp = (0.5 - (0.5 * math.cos((2.0 * (0.5 * math.pi))))) * (b * b) else: tmp = math.pow((0.005555555555555556 * (math.fabs(a) * (angle * math.pi))), 2.0) + math.pow(b, 2.0) return tmp
function code(a, b, angle) tmp = 0.0 if (abs(a) <= 1.678151993572926e+37) tmp = Float64(Float64(0.5 - Float64(0.5 * cos(Float64(2.0 * Float64(0.5 * pi))))) * Float64(b * b)); else tmp = Float64((Float64(0.005555555555555556 * Float64(abs(a) * Float64(angle * pi))) ^ 2.0) + (b ^ 2.0)); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (abs(a) <= 1.678151993572926e+37) tmp = (0.5 - (0.5 * cos((2.0 * (0.5 * pi))))) * (b * b); else tmp = ((0.005555555555555556 * (abs(a) * (angle * pi))) ^ 2.0) + (b ^ 2.0); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[N[Abs[a], $MachinePrecision], 1.678151993572926e+37], N[(N[(0.5 - N[(0.5 * N[Cos[N[(2.0 * N[(0.5 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(0.005555555555555556 * N[(N[Abs[a], $MachinePrecision] * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]]
f(a, b, angle): a in [-inf, +inf], b in [-inf, +inf], angle in [-inf, +inf] code: THEORY BEGIN f(a, b, angle: real): real = LET tmp = IF ((abs(a)) <= (16781519935729260116091134213040898048)) THEN (((5e-1) - ((5e-1) * (cos(((2) * ((5e-1) * (4 * atan(1)))))))) * (b * b)) ELSE ((((5555555555555555767577313730498644872568547725677490234375e-60) * ((abs(a)) * (angle * (4 * atan(1))))) ^ (2)) + (b ^ (2))) ENDIF IN tmp END code
\begin{array}{l}
\mathbf{if}\;\left|a\right| \leq 1.678151993572926 \cdot 10^{+37}:\\
\;\;\;\;\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(0.5 \cdot \pi\right)\right)\right) \cdot \left(b \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;{\left(0.005555555555555556 \cdot \left(\left|a\right| \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {b}^{2}\\
\end{array}
if a < 1.678151993572926e37Initial program 79.0%
Taylor expanded in a around 0
Applied rewrites56.3%
Applied rewrites56.4%
Taylor expanded in angle around 0
Applied rewrites56.6%
Applied rewrites56.6%
if 1.678151993572926e37 < a Initial program 79.0%
Taylor expanded in angle around 0
Applied rewrites79.0%
Taylor expanded in angle around 0
Applied rewrites73.9%
(FPCore (a b angle) :precision binary64 :pre TRUE (if (<= (fabs a) 1.678151993572926e+37) (/ 1.0 (/ 1.0 (* b b))) (+ (pow (* 0.005555555555555556 (* (fabs a) (* angle PI))) 2.0) (pow b 2.0))))
double code(double a, double b, double angle) {
double tmp;
if (fabs(a) <= 1.678151993572926e+37) {
tmp = 1.0 / (1.0 / (b * b));
} else {
tmp = pow((0.005555555555555556 * (fabs(a) * (angle * ((double) M_PI)))), 2.0) + pow(b, 2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (Math.abs(a) <= 1.678151993572926e+37) {
tmp = 1.0 / (1.0 / (b * b));
} else {
tmp = Math.pow((0.005555555555555556 * (Math.abs(a) * (angle * Math.PI))), 2.0) + Math.pow(b, 2.0);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if math.fabs(a) <= 1.678151993572926e+37: tmp = 1.0 / (1.0 / (b * b)) else: tmp = math.pow((0.005555555555555556 * (math.fabs(a) * (angle * math.pi))), 2.0) + math.pow(b, 2.0) return tmp
function code(a, b, angle) tmp = 0.0 if (abs(a) <= 1.678151993572926e+37) tmp = Float64(1.0 / Float64(1.0 / Float64(b * b))); else tmp = Float64((Float64(0.005555555555555556 * Float64(abs(a) * Float64(angle * pi))) ^ 2.0) + (b ^ 2.0)); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (abs(a) <= 1.678151993572926e+37) tmp = 1.0 / (1.0 / (b * b)); else tmp = ((0.005555555555555556 * (abs(a) * (angle * pi))) ^ 2.0) + (b ^ 2.0); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[N[Abs[a], $MachinePrecision], 1.678151993572926e+37], N[(1.0 / N[(1.0 / N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(0.005555555555555556 * N[(N[Abs[a], $MachinePrecision] * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]]
f(a, b, angle): a in [-inf, +inf], b in [-inf, +inf], angle in [-inf, +inf] code: THEORY BEGIN f(a, b, angle: real): real = LET tmp = IF ((abs(a)) <= (16781519935729260116091134213040898048)) THEN ((1) / ((1) / (b * b))) ELSE ((((5555555555555555767577313730498644872568547725677490234375e-60) * ((abs(a)) * (angle * (4 * atan(1))))) ^ (2)) + (b ^ (2))) ENDIF IN tmp END code
\begin{array}{l}
\mathbf{if}\;\left|a\right| \leq 1.678151993572926 \cdot 10^{+37}:\\
\;\;\;\;\frac{1}{\frac{1}{b \cdot b}}\\
\mathbf{else}:\\
\;\;\;\;{\left(0.005555555555555556 \cdot \left(\left|a\right| \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {b}^{2}\\
\end{array}
if a < 1.678151993572926e37Initial program 79.0%
Applied rewrites66.6%
Taylor expanded in angle around 0
Applied rewrites56.4%
Applied rewrites56.4%
if 1.678151993572926e37 < a Initial program 79.0%
Taylor expanded in angle around 0
Applied rewrites79.0%
Taylor expanded in angle around 0
Applied rewrites73.9%
(FPCore (a b angle)
:precision binary64
:pre TRUE
(let* ((t_0 (* (/ angle 180.0) PI)))
(if (<=
(+ (pow (* a (sin t_0)) 2.0) (pow (* b (cos t_0)) 2.0))
5e+297)
(/ 1.0 (/ 1.0 (* b b)))
(/ 1.0 (/ 1.0 (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)) <= 5e+297) {
tmp = 1.0 / (1.0 / (b * b));
} else {
tmp = 1.0 / (1.0 / 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)) <= 5e+297) {
tmp = 1.0 / (1.0 / (b * b));
} else {
tmp = 1.0 / (1.0 / 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)) <= 5e+297: tmp = 1.0 / (1.0 / (b * b)) else: tmp = 1.0 / (1.0 / 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)) <= 5e+297) tmp = Float64(1.0 / Float64(1.0 / Float64(b * b))); else tmp = Float64(1.0 / Float64(1.0 / 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)) <= 5e+297) tmp = 1.0 / (1.0 / (b * b)); else tmp = 1.0 / (1.0 / 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], 5e+297], N[(1.0 / N[(1.0 / N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(1.0 / N[Sqrt[N[(N[(b * b), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
f(a, b, angle): a in [-inf, +inf], b in [-inf, +inf], angle in [-inf, +inf] code: THEORY BEGIN f(a, b, angle: real): real = LET t_0 = ((angle / (180)) * (4 * atan(1))) IN LET tmp = IF ((((a * (sin(t_0))) ^ (2)) + ((b * (cos(t_0))) ^ (2))) <= (4999999999999999797831017376714894119127812233696870733560457558998243835015834942700401512775872587353423939115559831572611431741498074611166071691150501229607379410134558461510763529142729843207341692956811227775656913210014077504201792814563184923802875085144633272926482892941009176900625498112)) THEN ((1) / ((1) / (b * b))) ELSE ((1) / ((1) / (sqrt(((b * b) * (b * b)))))) ENDIF IN tmp END code
\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 5 \cdot 10^{+297}:\\
\;\;\;\;\frac{1}{\frac{1}{b \cdot b}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{1}{\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))) < 4.9999999999999998e297Initial program 79.0%
Applied rewrites66.6%
Taylor expanded in angle around 0
Applied rewrites56.4%
Applied rewrites56.4%
if 4.9999999999999998e297 < (+.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.0%
Applied rewrites66.6%
Taylor expanded in angle around 0
Applied rewrites56.4%
Applied rewrites56.4%
lift-*.f64N/A
fabs-sqrN/A
pow2N/A
lift-pow.f64N/A
rem-sqrt-square-revN/A
lower-sqrt.f64N/A
lower-*.f6448.8%
lift-pow.f64N/A
pow2N/A
lift-*.f6448.8%
lift-pow.f64N/A
pow2N/A
lift-*.f6448.8%
Applied rewrites48.8%
(FPCore (a b angle) :precision binary64 :pre TRUE (/ 1.0 (/ 1.0 (* b b))))
double code(double a, double b, double angle) {
return 1.0 / (1.0 / (b * b));
}
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 = 1.0d0 / (1.0d0 / (b * b))
end function
public static double code(double a, double b, double angle) {
return 1.0 / (1.0 / (b * b));
}
def code(a, b, angle): return 1.0 / (1.0 / (b * b))
function code(a, b, angle) return Float64(1.0 / Float64(1.0 / Float64(b * b))) end
function tmp = code(a, b, angle) tmp = 1.0 / (1.0 / (b * b)); end
code[a_, b_, angle_] := N[(1.0 / N[(1.0 / N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
f(a, b, angle): a in [-inf, +inf], b in [-inf, +inf], angle in [-inf, +inf] code: THEORY BEGIN f(a, b, angle: real): real = (1) / ((1) / (b * b)) END code
\frac{1}{\frac{1}{b \cdot b}}
Initial program 79.0%
Applied rewrites66.6%
Taylor expanded in angle around 0
Applied rewrites56.4%
Applied rewrites56.4%
herbie shell --seed 2026047
(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)))