
(FPCore (F l) :precision binary64 (- (* PI l) (* (/ 1.0 (* F F)) (tan (* PI l)))))
double code(double F, double l) {
return (((double) M_PI) * l) - ((1.0 / (F * F)) * tan((((double) M_PI) * l)));
}
public static double code(double F, double l) {
return (Math.PI * l) - ((1.0 / (F * F)) * Math.tan((Math.PI * l)));
}
def code(F, l): return (math.pi * l) - ((1.0 / (F * F)) * math.tan((math.pi * l)))
function code(F, l) return Float64(Float64(pi * l) - Float64(Float64(1.0 / Float64(F * F)) * tan(Float64(pi * l)))) end
function tmp = code(F, l) tmp = (pi * l) - ((1.0 / (F * F)) * tan((pi * l))); end
code[F_, l_] := N[(N[(Pi * l), $MachinePrecision] - N[(N[(1.0 / N[(F * F), $MachinePrecision]), $MachinePrecision] * N[Tan[N[(Pi * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (F l) :precision binary64 (- (* PI l) (* (/ 1.0 (* F F)) (tan (* PI l)))))
double code(double F, double l) {
return (((double) M_PI) * l) - ((1.0 / (F * F)) * tan((((double) M_PI) * l)));
}
public static double code(double F, double l) {
return (Math.PI * l) - ((1.0 / (F * F)) * Math.tan((Math.PI * l)));
}
def code(F, l): return (math.pi * l) - ((1.0 / (F * F)) * math.tan((math.pi * l)))
function code(F, l) return Float64(Float64(pi * l) - Float64(Float64(1.0 / Float64(F * F)) * tan(Float64(pi * l)))) end
function tmp = code(F, l) tmp = (pi * l) - ((1.0 / (F * F)) * tan((pi * l))); end
code[F_, l_] := N[(N[(Pi * l), $MachinePrecision] - N[(N[(1.0 / N[(F * F), $MachinePrecision]), $MachinePrecision] * N[Tan[N[(Pi * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right)
\end{array}
(FPCore (F l) :precision binary64 (if (or (<= (* PI l) -1e+38) (not (<= (* PI l) 10000000000000.0))) (* PI l) (- (* PI l) (/ (/ (tan (* PI l)) F) F))))
double code(double F, double l) {
double tmp;
if (((((double) M_PI) * l) <= -1e+38) || !((((double) M_PI) * l) <= 10000000000000.0)) {
tmp = ((double) M_PI) * l;
} else {
tmp = (((double) M_PI) * l) - ((tan((((double) M_PI) * l)) / F) / F);
}
return tmp;
}
public static double code(double F, double l) {
double tmp;
if (((Math.PI * l) <= -1e+38) || !((Math.PI * l) <= 10000000000000.0)) {
tmp = Math.PI * l;
} else {
tmp = (Math.PI * l) - ((Math.tan((Math.PI * l)) / F) / F);
}
return tmp;
}
def code(F, l): tmp = 0 if ((math.pi * l) <= -1e+38) or not ((math.pi * l) <= 10000000000000.0): tmp = math.pi * l else: tmp = (math.pi * l) - ((math.tan((math.pi * l)) / F) / F) return tmp
function code(F, l) tmp = 0.0 if ((Float64(pi * l) <= -1e+38) || !(Float64(pi * l) <= 10000000000000.0)) tmp = Float64(pi * l); else tmp = Float64(Float64(pi * l) - Float64(Float64(tan(Float64(pi * l)) / F) / F)); end return tmp end
function tmp_2 = code(F, l) tmp = 0.0; if (((pi * l) <= -1e+38) || ~(((pi * l) <= 10000000000000.0))) tmp = pi * l; else tmp = (pi * l) - ((tan((pi * l)) / F) / F); end tmp_2 = tmp; end
code[F_, l_] := If[Or[LessEqual[N[(Pi * l), $MachinePrecision], -1e+38], N[Not[LessEqual[N[(Pi * l), $MachinePrecision], 10000000000000.0]], $MachinePrecision]], N[(Pi * l), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] - N[(N[(N[Tan[N[(Pi * l), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\pi \cdot \ell \leq -1 \cdot 10^{+38} \lor \neg \left(\pi \cdot \ell \leq 10000000000000\right):\\
\;\;\;\;\pi \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < -9.99999999999999977e37 or 1e13 < (*.f64 (PI.f64) l) Initial program 55.7%
associate-*l/55.7%
*-lft-identity55.7%
Simplified55.7%
Taylor expanded in l around 0 41.2%
unpow241.2%
Simplified41.2%
Taylor expanded in F around inf 99.6%
if -9.99999999999999977e37 < (*.f64 (PI.f64) l) < 1e13Initial program 89.4%
associate-*l/91.1%
*-un-lft-identity91.1%
associate-/r*99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (F l) :precision binary64 (if (or (<= (* PI l) -10000.0) (not (<= (* PI l) 50000000.0))) (* PI l) (- (* PI l) (* (/ PI F) (/ l F)))))
double code(double F, double l) {
double tmp;
if (((((double) M_PI) * l) <= -10000.0) || !((((double) M_PI) * l) <= 50000000.0)) {
tmp = ((double) M_PI) * l;
} else {
tmp = (((double) M_PI) * l) - ((((double) M_PI) / F) * (l / F));
}
return tmp;
}
public static double code(double F, double l) {
double tmp;
if (((Math.PI * l) <= -10000.0) || !((Math.PI * l) <= 50000000.0)) {
tmp = Math.PI * l;
} else {
tmp = (Math.PI * l) - ((Math.PI / F) * (l / F));
}
return tmp;
}
def code(F, l): tmp = 0 if ((math.pi * l) <= -10000.0) or not ((math.pi * l) <= 50000000.0): tmp = math.pi * l else: tmp = (math.pi * l) - ((math.pi / F) * (l / F)) return tmp
function code(F, l) tmp = 0.0 if ((Float64(pi * l) <= -10000.0) || !(Float64(pi * l) <= 50000000.0)) tmp = Float64(pi * l); else tmp = Float64(Float64(pi * l) - Float64(Float64(pi / F) * Float64(l / F))); end return tmp end
function tmp_2 = code(F, l) tmp = 0.0; if (((pi * l) <= -10000.0) || ~(((pi * l) <= 50000000.0))) tmp = pi * l; else tmp = (pi * l) - ((pi / F) * (l / F)); end tmp_2 = tmp; end
code[F_, l_] := If[Or[LessEqual[N[(Pi * l), $MachinePrecision], -10000.0], N[Not[LessEqual[N[(Pi * l), $MachinePrecision], 50000000.0]], $MachinePrecision]], N[(Pi * l), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] - N[(N[(Pi / F), $MachinePrecision] * N[(l / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\pi \cdot \ell \leq -10000 \lor \neg \left(\pi \cdot \ell \leq 50000000\right):\\
\;\;\;\;\pi \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell - \frac{\pi}{F} \cdot \frac{\ell}{F}\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < -1e4 or 5e7 < (*.f64 (PI.f64) l) Initial program 57.8%
associate-*l/57.8%
*-lft-identity57.8%
Simplified57.8%
Taylor expanded in l around 0 42.4%
unpow242.4%
Simplified42.4%
Taylor expanded in F around inf 98.0%
if -1e4 < (*.f64 (PI.f64) l) < 5e7Initial program 88.9%
associate-*l/90.7%
*-un-lft-identity90.7%
associate-/r*99.6%
Applied egg-rr99.6%
Taylor expanded in l around 0 90.2%
*-commutative90.2%
unpow290.2%
times-frac99.2%
Simplified99.2%
Final simplification98.6%
(FPCore (F l) :precision binary64 (if (or (<= l -0.5) (not (<= l 1550000000.0))) (* PI l) (- (* PI l) (/ (/ PI (/ F l)) F))))
double code(double F, double l) {
double tmp;
if ((l <= -0.5) || !(l <= 1550000000.0)) {
tmp = ((double) M_PI) * l;
} else {
tmp = (((double) M_PI) * l) - ((((double) M_PI) / (F / l)) / F);
}
return tmp;
}
public static double code(double F, double l) {
double tmp;
if ((l <= -0.5) || !(l <= 1550000000.0)) {
tmp = Math.PI * l;
} else {
tmp = (Math.PI * l) - ((Math.PI / (F / l)) / F);
}
return tmp;
}
def code(F, l): tmp = 0 if (l <= -0.5) or not (l <= 1550000000.0): tmp = math.pi * l else: tmp = (math.pi * l) - ((math.pi / (F / l)) / F) return tmp
function code(F, l) tmp = 0.0 if ((l <= -0.5) || !(l <= 1550000000.0)) tmp = Float64(pi * l); else tmp = Float64(Float64(pi * l) - Float64(Float64(pi / Float64(F / l)) / F)); end return tmp end
function tmp_2 = code(F, l) tmp = 0.0; if ((l <= -0.5) || ~((l <= 1550000000.0))) tmp = pi * l; else tmp = (pi * l) - ((pi / (F / l)) / F); end tmp_2 = tmp; end
code[F_, l_] := If[Or[LessEqual[l, -0.5], N[Not[LessEqual[l, 1550000000.0]], $MachinePrecision]], N[(Pi * l), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] - N[(N[(Pi / N[(F / l), $MachinePrecision]), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -0.5 \lor \neg \left(\ell \leq 1550000000\right):\\
\;\;\;\;\pi \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell - \frac{\frac{\pi}{\frac{F}{\ell}}}{F}\\
\end{array}
\end{array}
if l < -0.5 or 1.55e9 < l Initial program 57.8%
associate-*l/57.8%
*-lft-identity57.8%
Simplified57.8%
Taylor expanded in l around 0 42.4%
unpow242.4%
Simplified42.4%
Taylor expanded in F around inf 98.0%
if -0.5 < l < 1.55e9Initial program 88.9%
associate-*l/90.7%
*-lft-identity90.7%
Simplified90.7%
Taylor expanded in l around 0 88.4%
unpow288.4%
Simplified88.4%
*-un-lft-identity88.4%
times-frac88.4%
Applied egg-rr88.4%
associate-*l/88.4%
*-lft-identity88.4%
Simplified88.4%
clear-num88.4%
associate-/r/88.4%
Applied egg-rr88.4%
Taylor expanded in F around 0 90.2%
mul-1-neg90.2%
unsub-neg90.2%
unpow290.2%
times-frac99.2%
associate-*l/99.0%
*-commutative99.0%
associate-*l/99.1%
associate-/l*99.1%
Simplified99.1%
Final simplification98.6%
(FPCore (F l) :precision binary64 (if (or (<= l -0.5) (not (<= l 1550000000.0))) (* PI l) (* l (- PI (/ PI (* F F))))))
double code(double F, double l) {
double tmp;
if ((l <= -0.5) || !(l <= 1550000000.0)) {
tmp = ((double) M_PI) * l;
} else {
tmp = l * (((double) M_PI) - (((double) M_PI) / (F * F)));
}
return tmp;
}
public static double code(double F, double l) {
double tmp;
if ((l <= -0.5) || !(l <= 1550000000.0)) {
tmp = Math.PI * l;
} else {
tmp = l * (Math.PI - (Math.PI / (F * F)));
}
return tmp;
}
def code(F, l): tmp = 0 if (l <= -0.5) or not (l <= 1550000000.0): tmp = math.pi * l else: tmp = l * (math.pi - (math.pi / (F * F))) return tmp
function code(F, l) tmp = 0.0 if ((l <= -0.5) || !(l <= 1550000000.0)) tmp = Float64(pi * l); else tmp = Float64(l * Float64(pi - Float64(pi / Float64(F * F)))); end return tmp end
function tmp_2 = code(F, l) tmp = 0.0; if ((l <= -0.5) || ~((l <= 1550000000.0))) tmp = pi * l; else tmp = l * (pi - (pi / (F * F))); end tmp_2 = tmp; end
code[F_, l_] := If[Or[LessEqual[l, -0.5], N[Not[LessEqual[l, 1550000000.0]], $MachinePrecision]], N[(Pi * l), $MachinePrecision], N[(l * N[(Pi - N[(Pi / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -0.5 \lor \neg \left(\ell \leq 1550000000\right):\\
\;\;\;\;\pi \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;\ell \cdot \left(\pi - \frac{\pi}{F \cdot F}\right)\\
\end{array}
\end{array}
if l < -0.5 or 1.55e9 < l Initial program 57.8%
associate-*l/57.8%
*-lft-identity57.8%
Simplified57.8%
Taylor expanded in l around 0 42.4%
unpow242.4%
Simplified42.4%
Taylor expanded in F around inf 98.0%
if -0.5 < l < 1.55e9Initial program 88.9%
associate-*l/90.7%
*-lft-identity90.7%
Simplified90.7%
Taylor expanded in l around 0 88.4%
unpow288.4%
Simplified88.4%
Final simplification93.1%
(FPCore (F l) :precision binary64 (if (or (<= l -0.5) (not (<= l 1550000000.0))) (* PI l) (* l (- PI (/ (/ PI F) F)))))
double code(double F, double l) {
double tmp;
if ((l <= -0.5) || !(l <= 1550000000.0)) {
tmp = ((double) M_PI) * l;
} else {
tmp = l * (((double) M_PI) - ((((double) M_PI) / F) / F));
}
return tmp;
}
public static double code(double F, double l) {
double tmp;
if ((l <= -0.5) || !(l <= 1550000000.0)) {
tmp = Math.PI * l;
} else {
tmp = l * (Math.PI - ((Math.PI / F) / F));
}
return tmp;
}
def code(F, l): tmp = 0 if (l <= -0.5) or not (l <= 1550000000.0): tmp = math.pi * l else: tmp = l * (math.pi - ((math.pi / F) / F)) return tmp
function code(F, l) tmp = 0.0 if ((l <= -0.5) || !(l <= 1550000000.0)) tmp = Float64(pi * l); else tmp = Float64(l * Float64(pi - Float64(Float64(pi / F) / F))); end return tmp end
function tmp_2 = code(F, l) tmp = 0.0; if ((l <= -0.5) || ~((l <= 1550000000.0))) tmp = pi * l; else tmp = l * (pi - ((pi / F) / F)); end tmp_2 = tmp; end
code[F_, l_] := If[Or[LessEqual[l, -0.5], N[Not[LessEqual[l, 1550000000.0]], $MachinePrecision]], N[(Pi * l), $MachinePrecision], N[(l * N[(Pi - N[(N[(Pi / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -0.5 \lor \neg \left(\ell \leq 1550000000\right):\\
\;\;\;\;\pi \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;\ell \cdot \left(\pi - \frac{\frac{\pi}{F}}{F}\right)\\
\end{array}
\end{array}
if l < -0.5 or 1.55e9 < l Initial program 57.8%
associate-*l/57.8%
*-lft-identity57.8%
Simplified57.8%
Taylor expanded in l around 0 42.4%
unpow242.4%
Simplified42.4%
Taylor expanded in F around inf 98.0%
if -0.5 < l < 1.55e9Initial program 88.9%
associate-*l/90.7%
*-lft-identity90.7%
Simplified90.7%
Taylor expanded in l around 0 88.4%
unpow288.4%
Simplified88.4%
*-un-lft-identity88.4%
times-frac88.4%
Applied egg-rr88.4%
associate-*l/88.4%
*-lft-identity88.4%
Simplified88.4%
Final simplification93.1%
(FPCore (F l) :precision binary64 (if (or (<= l -0.5) (not (<= l 1420000000.0))) (* PI l) (* (* PI l) (- 1.0 (pow F -2.0)))))
double code(double F, double l) {
double tmp;
if ((l <= -0.5) || !(l <= 1420000000.0)) {
tmp = ((double) M_PI) * l;
} else {
tmp = (((double) M_PI) * l) * (1.0 - pow(F, -2.0));
}
return tmp;
}
public static double code(double F, double l) {
double tmp;
if ((l <= -0.5) || !(l <= 1420000000.0)) {
tmp = Math.PI * l;
} else {
tmp = (Math.PI * l) * (1.0 - Math.pow(F, -2.0));
}
return tmp;
}
def code(F, l): tmp = 0 if (l <= -0.5) or not (l <= 1420000000.0): tmp = math.pi * l else: tmp = (math.pi * l) * (1.0 - math.pow(F, -2.0)) return tmp
function code(F, l) tmp = 0.0 if ((l <= -0.5) || !(l <= 1420000000.0)) tmp = Float64(pi * l); else tmp = Float64(Float64(pi * l) * Float64(1.0 - (F ^ -2.0))); end return tmp end
function tmp_2 = code(F, l) tmp = 0.0; if ((l <= -0.5) || ~((l <= 1420000000.0))) tmp = pi * l; else tmp = (pi * l) * (1.0 - (F ^ -2.0)); end tmp_2 = tmp; end
code[F_, l_] := If[Or[LessEqual[l, -0.5], N[Not[LessEqual[l, 1420000000.0]], $MachinePrecision]], N[(Pi * l), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] * N[(1.0 - N[Power[F, -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -0.5 \lor \neg \left(\ell \leq 1420000000\right):\\
\;\;\;\;\pi \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;\left(\pi \cdot \ell\right) \cdot \left(1 - {F}^{-2}\right)\\
\end{array}
\end{array}
if l < -0.5 or 1.42e9 < l Initial program 57.8%
associate-*l/57.8%
*-lft-identity57.8%
Simplified57.8%
Taylor expanded in l around 0 42.4%
unpow242.4%
Simplified42.4%
Taylor expanded in F around inf 98.0%
if -0.5 < l < 1.42e9Initial program 88.9%
associate-*l/90.7%
*-lft-identity90.7%
Simplified90.7%
Taylor expanded in l around 0 88.4%
unpow288.4%
Simplified88.4%
*-un-lft-identity88.4%
times-frac88.4%
Applied egg-rr88.4%
associate-*l/88.4%
*-lft-identity88.4%
Simplified88.4%
Taylor expanded in l around 0 88.4%
sub-neg88.4%
distribute-lft-in88.4%
unpow288.4%
*-rgt-identity88.4%
times-frac88.4%
*-rgt-identity88.4%
associate-*r/88.3%
associate-*r*88.3%
unpow-188.3%
unpow-188.3%
pow-sqr88.4%
metadata-eval88.4%
distribute-rgt-neg-out88.4%
*-rgt-identity88.4%
associate-*r*88.4%
Simplified88.4%
Final simplification93.1%
(FPCore (F l)
:precision binary64
(if (or (<= (* F F) 4e-261)
(and (not (<= (* F F) 2e-207))
(or (<= (* F F) 2e-68) (not (<= (* F F) 5e-14)))))
(* PI l)
(* (/ PI (* F F)) (- l))))
double code(double F, double l) {
double tmp;
if (((F * F) <= 4e-261) || (!((F * F) <= 2e-207) && (((F * F) <= 2e-68) || !((F * F) <= 5e-14)))) {
tmp = ((double) M_PI) * l;
} else {
tmp = (((double) M_PI) / (F * F)) * -l;
}
return tmp;
}
public static double code(double F, double l) {
double tmp;
if (((F * F) <= 4e-261) || (!((F * F) <= 2e-207) && (((F * F) <= 2e-68) || !((F * F) <= 5e-14)))) {
tmp = Math.PI * l;
} else {
tmp = (Math.PI / (F * F)) * -l;
}
return tmp;
}
def code(F, l): tmp = 0 if ((F * F) <= 4e-261) or (not ((F * F) <= 2e-207) and (((F * F) <= 2e-68) or not ((F * F) <= 5e-14))): tmp = math.pi * l else: tmp = (math.pi / (F * F)) * -l return tmp
function code(F, l) tmp = 0.0 if ((Float64(F * F) <= 4e-261) || (!(Float64(F * F) <= 2e-207) && ((Float64(F * F) <= 2e-68) || !(Float64(F * F) <= 5e-14)))) tmp = Float64(pi * l); else tmp = Float64(Float64(pi / Float64(F * F)) * Float64(-l)); end return tmp end
function tmp_2 = code(F, l) tmp = 0.0; if (((F * F) <= 4e-261) || (~(((F * F) <= 2e-207)) && (((F * F) <= 2e-68) || ~(((F * F) <= 5e-14))))) tmp = pi * l; else tmp = (pi / (F * F)) * -l; end tmp_2 = tmp; end
code[F_, l_] := If[Or[LessEqual[N[(F * F), $MachinePrecision], 4e-261], And[N[Not[LessEqual[N[(F * F), $MachinePrecision], 2e-207]], $MachinePrecision], Or[LessEqual[N[(F * F), $MachinePrecision], 2e-68], N[Not[LessEqual[N[(F * F), $MachinePrecision], 5e-14]], $MachinePrecision]]]], N[(Pi * l), $MachinePrecision], N[(N[(Pi / N[(F * F), $MachinePrecision]), $MachinePrecision] * (-l)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \cdot F \leq 4 \cdot 10^{-261} \lor \neg \left(F \cdot F \leq 2 \cdot 10^{-207}\right) \land \left(F \cdot F \leq 2 \cdot 10^{-68} \lor \neg \left(F \cdot F \leq 5 \cdot 10^{-14}\right)\right):\\
\;\;\;\;\pi \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;\frac{\pi}{F \cdot F} \cdot \left(-\ell\right)\\
\end{array}
\end{array}
if (*.f64 F F) < 3.99999999999999994e-261 or 1.99999999999999985e-207 < (*.f64 F F) < 2.00000000000000013e-68 or 5.0000000000000002e-14 < (*.f64 F F) Initial program 72.2%
associate-*l/73.2%
*-lft-identity73.2%
Simplified73.2%
Taylor expanded in l around 0 64.6%
unpow264.6%
Simplified64.6%
Taylor expanded in F around inf 80.0%
if 3.99999999999999994e-261 < (*.f64 F F) < 1.99999999999999985e-207 or 2.00000000000000013e-68 < (*.f64 F F) < 5.0000000000000002e-14Initial program 88.6%
associate-*l/88.5%
*-lft-identity88.5%
Simplified88.5%
Taylor expanded in l around 0 78.5%
unpow278.5%
Simplified78.5%
Taylor expanded in F around 0 78.0%
unpow278.0%
associate-*r/78.0%
neg-mul-178.0%
Simplified78.0%
Final simplification79.8%
(FPCore (F l)
:precision binary64
(if (<= (* F F) 4e-261)
(* PI l)
(if (<= (* F F) 2e-207)
(* (/ PI (* F F)) (- l))
(if (or (<= (* F F) 2e-68) (not (<= (* F F) 5e-14)))
(* PI l)
(* l (/ (/ PI (- F)) F))))))
double code(double F, double l) {
double tmp;
if ((F * F) <= 4e-261) {
tmp = ((double) M_PI) * l;
} else if ((F * F) <= 2e-207) {
tmp = (((double) M_PI) / (F * F)) * -l;
} else if (((F * F) <= 2e-68) || !((F * F) <= 5e-14)) {
tmp = ((double) M_PI) * l;
} else {
tmp = l * ((((double) M_PI) / -F) / F);
}
return tmp;
}
public static double code(double F, double l) {
double tmp;
if ((F * F) <= 4e-261) {
tmp = Math.PI * l;
} else if ((F * F) <= 2e-207) {
tmp = (Math.PI / (F * F)) * -l;
} else if (((F * F) <= 2e-68) || !((F * F) <= 5e-14)) {
tmp = Math.PI * l;
} else {
tmp = l * ((Math.PI / -F) / F);
}
return tmp;
}
def code(F, l): tmp = 0 if (F * F) <= 4e-261: tmp = math.pi * l elif (F * F) <= 2e-207: tmp = (math.pi / (F * F)) * -l elif ((F * F) <= 2e-68) or not ((F * F) <= 5e-14): tmp = math.pi * l else: tmp = l * ((math.pi / -F) / F) return tmp
function code(F, l) tmp = 0.0 if (Float64(F * F) <= 4e-261) tmp = Float64(pi * l); elseif (Float64(F * F) <= 2e-207) tmp = Float64(Float64(pi / Float64(F * F)) * Float64(-l)); elseif ((Float64(F * F) <= 2e-68) || !(Float64(F * F) <= 5e-14)) tmp = Float64(pi * l); else tmp = Float64(l * Float64(Float64(pi / Float64(-F)) / F)); end return tmp end
function tmp_2 = code(F, l) tmp = 0.0; if ((F * F) <= 4e-261) tmp = pi * l; elseif ((F * F) <= 2e-207) tmp = (pi / (F * F)) * -l; elseif (((F * F) <= 2e-68) || ~(((F * F) <= 5e-14))) tmp = pi * l; else tmp = l * ((pi / -F) / F); end tmp_2 = tmp; end
code[F_, l_] := If[LessEqual[N[(F * F), $MachinePrecision], 4e-261], N[(Pi * l), $MachinePrecision], If[LessEqual[N[(F * F), $MachinePrecision], 2e-207], N[(N[(Pi / N[(F * F), $MachinePrecision]), $MachinePrecision] * (-l)), $MachinePrecision], If[Or[LessEqual[N[(F * F), $MachinePrecision], 2e-68], N[Not[LessEqual[N[(F * F), $MachinePrecision], 5e-14]], $MachinePrecision]], N[(Pi * l), $MachinePrecision], N[(l * N[(N[(Pi / (-F)), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \cdot F \leq 4 \cdot 10^{-261}:\\
\;\;\;\;\pi \cdot \ell\\
\mathbf{elif}\;F \cdot F \leq 2 \cdot 10^{-207}:\\
\;\;\;\;\frac{\pi}{F \cdot F} \cdot \left(-\ell\right)\\
\mathbf{elif}\;F \cdot F \leq 2 \cdot 10^{-68} \lor \neg \left(F \cdot F \leq 5 \cdot 10^{-14}\right):\\
\;\;\;\;\pi \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;\ell \cdot \frac{\frac{\pi}{-F}}{F}\\
\end{array}
\end{array}
if (*.f64 F F) < 3.99999999999999994e-261 or 1.99999999999999985e-207 < (*.f64 F F) < 2.00000000000000013e-68 or 5.0000000000000002e-14 < (*.f64 F F) Initial program 72.2%
associate-*l/73.2%
*-lft-identity73.2%
Simplified73.2%
Taylor expanded in l around 0 64.6%
unpow264.6%
Simplified64.6%
Taylor expanded in F around inf 80.0%
if 3.99999999999999994e-261 < (*.f64 F F) < 1.99999999999999985e-207Initial program 82.3%
associate-*l/82.3%
*-lft-identity82.3%
Simplified82.3%
Taylor expanded in l around 0 80.9%
unpow280.9%
Simplified80.9%
Taylor expanded in F around 0 80.9%
unpow280.9%
associate-*r/80.9%
neg-mul-180.9%
Simplified80.9%
if 2.00000000000000013e-68 < (*.f64 F F) < 5.0000000000000002e-14Initial program 93.9%
associate-*l/93.8%
*-lft-identity93.8%
Simplified93.8%
Taylor expanded in l around 0 76.5%
unpow276.5%
Simplified76.5%
Taylor expanded in F around 0 75.5%
unpow275.5%
associate-*r/75.5%
neg-mul-175.5%
Simplified75.5%
Taylor expanded in F around 0 75.5%
metadata-eval75.5%
unpow275.5%
times-frac75.5%
*-lft-identity75.5%
neg-mul-175.5%
distribute-lft-neg-in75.5%
associate-/r*75.8%
Simplified75.8%
Final simplification79.8%
(FPCore (F l)
:precision binary64
(let* ((t_0 (/ PI (- F))))
(if (<= F 7e-287)
(* PI l)
(if (<= F 6e-103)
(* (/ l F) t_0)
(if (or (<= F 5.8e-34) (not (<= F 4.6e-7)))
(* PI l)
(* l (/ t_0 F)))))))
double code(double F, double l) {
double t_0 = ((double) M_PI) / -F;
double tmp;
if (F <= 7e-287) {
tmp = ((double) M_PI) * l;
} else if (F <= 6e-103) {
tmp = (l / F) * t_0;
} else if ((F <= 5.8e-34) || !(F <= 4.6e-7)) {
tmp = ((double) M_PI) * l;
} else {
tmp = l * (t_0 / F);
}
return tmp;
}
public static double code(double F, double l) {
double t_0 = Math.PI / -F;
double tmp;
if (F <= 7e-287) {
tmp = Math.PI * l;
} else if (F <= 6e-103) {
tmp = (l / F) * t_0;
} else if ((F <= 5.8e-34) || !(F <= 4.6e-7)) {
tmp = Math.PI * l;
} else {
tmp = l * (t_0 / F);
}
return tmp;
}
def code(F, l): t_0 = math.pi / -F tmp = 0 if F <= 7e-287: tmp = math.pi * l elif F <= 6e-103: tmp = (l / F) * t_0 elif (F <= 5.8e-34) or not (F <= 4.6e-7): tmp = math.pi * l else: tmp = l * (t_0 / F) return tmp
function code(F, l) t_0 = Float64(pi / Float64(-F)) tmp = 0.0 if (F <= 7e-287) tmp = Float64(pi * l); elseif (F <= 6e-103) tmp = Float64(Float64(l / F) * t_0); elseif ((F <= 5.8e-34) || !(F <= 4.6e-7)) tmp = Float64(pi * l); else tmp = Float64(l * Float64(t_0 / F)); end return tmp end
function tmp_2 = code(F, l) t_0 = pi / -F; tmp = 0.0; if (F <= 7e-287) tmp = pi * l; elseif (F <= 6e-103) tmp = (l / F) * t_0; elseif ((F <= 5.8e-34) || ~((F <= 4.6e-7))) tmp = pi * l; else tmp = l * (t_0 / F); end tmp_2 = tmp; end
code[F_, l_] := Block[{t$95$0 = N[(Pi / (-F)), $MachinePrecision]}, If[LessEqual[F, 7e-287], N[(Pi * l), $MachinePrecision], If[LessEqual[F, 6e-103], N[(N[(l / F), $MachinePrecision] * t$95$0), $MachinePrecision], If[Or[LessEqual[F, 5.8e-34], N[Not[LessEqual[F, 4.6e-7]], $MachinePrecision]], N[(Pi * l), $MachinePrecision], N[(l * N[(t$95$0 / F), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\pi}{-F}\\
\mathbf{if}\;F \leq 7 \cdot 10^{-287}:\\
\;\;\;\;\pi \cdot \ell\\
\mathbf{elif}\;F \leq 6 \cdot 10^{-103}:\\
\;\;\;\;\frac{\ell}{F} \cdot t_0\\
\mathbf{elif}\;F \leq 5.8 \cdot 10^{-34} \lor \neg \left(F \leq 4.6 \cdot 10^{-7}\right):\\
\;\;\;\;\pi \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;\ell \cdot \frac{t_0}{F}\\
\end{array}
\end{array}
if F < 7e-287 or 6e-103 < F < 5.8000000000000004e-34 or 4.5999999999999999e-7 < F Initial program 79.9%
associate-*l/80.7%
*-lft-identity80.7%
Simplified80.7%
Taylor expanded in l around 0 71.8%
unpow271.8%
Simplified71.8%
Taylor expanded in F around inf 83.9%
if 7e-287 < F < 6e-103Initial program 43.7%
associate-*l/45.3%
*-lft-identity45.3%
Simplified45.3%
Taylor expanded in l around 0 38.7%
unpow238.7%
Simplified38.7%
Taylor expanded in F around 0 38.7%
unpow238.7%
associate-*r/38.7%
neg-mul-138.7%
Simplified38.7%
Taylor expanded in l around 0 40.3%
mul-1-neg40.3%
unpow240.3%
times-frac55.1%
distribute-rgt-neg-in55.1%
neg-mul-155.1%
metadata-eval55.1%
times-frac55.1%
*-lft-identity55.1%
neg-mul-155.1%
times-frac40.3%
*-commutative40.3%
distribute-rgt-neg-in40.3%
distribute-lft-neg-in40.3%
times-frac55.1%
Simplified55.1%
if 5.8000000000000004e-34 < F < 4.5999999999999999e-7Initial program 90.3%
associate-*l/90.3%
*-lft-identity90.3%
Simplified90.3%
Taylor expanded in l around 0 74.7%
unpow274.7%
Simplified74.7%
Taylor expanded in F around 0 74.7%
unpow274.7%
associate-*r/74.7%
neg-mul-174.7%
Simplified74.7%
Taylor expanded in F around 0 74.7%
metadata-eval74.7%
unpow274.7%
times-frac74.7%
*-lft-identity74.7%
neg-mul-174.7%
distribute-lft-neg-in74.7%
associate-/r*75.0%
Simplified75.0%
Final simplification78.5%
(FPCore (F l) :precision binary64 (* PI l))
double code(double F, double l) {
return ((double) M_PI) * l;
}
public static double code(double F, double l) {
return Math.PI * l;
}
def code(F, l): return math.pi * l
function code(F, l) return Float64(pi * l) end
function tmp = code(F, l) tmp = pi * l; end
code[F_, l_] := N[(Pi * l), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot \ell
\end{array}
Initial program 73.8%
associate-*l/74.7%
*-lft-identity74.7%
Simplified74.7%
Taylor expanded in l around 0 65.9%
unpow265.9%
Simplified65.9%
Taylor expanded in F around inf 74.6%
Final simplification74.6%
herbie shell --seed 2023229
(FPCore (F l)
:name "VandenBroeck and Keller, Equation (6)"
:precision binary64
(- (* PI l) (* (/ 1.0 (* F F)) (tan (* PI l)))))