
(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 8 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) -2e+17) (not (<= (* PI l) 200000000.0))) (* PI l) (- (* PI l) (/ (/ (tan (* PI l)) F) F))))
double code(double F, double l) {
double tmp;
if (((((double) M_PI) * l) <= -2e+17) || !((((double) M_PI) * l) <= 200000000.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) <= -2e+17) || !((Math.PI * l) <= 200000000.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) <= -2e+17) or not ((math.pi * l) <= 200000000.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) <= -2e+17) || !(Float64(pi * l) <= 200000000.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) <= -2e+17) || ~(((pi * l) <= 200000000.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], -2e+17], N[Not[LessEqual[N[(Pi * l), $MachinePrecision], 200000000.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 -2 \cdot 10^{+17} \lor \neg \left(\pi \cdot \ell \leq 200000000\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) < -2e17 or 2e8 < (*.f64 (PI.f64) l) Initial program 63.9%
sqr-neg63.9%
associate-*l/63.9%
*-lft-identity63.9%
sqr-neg63.9%
Simplified63.9%
Taylor expanded in l around 0 46.2%
unpow246.2%
Simplified46.2%
Taylor expanded in F around inf 99.6%
if -2e17 < (*.f64 (PI.f64) l) < 2e8Initial program 86.7%
associate-*l/89.2%
*-un-lft-identity89.2%
associate-/r*98.8%
Applied egg-rr98.8%
Final simplification99.2%
(FPCore (F l)
:precision binary64
(let* ((t_0 (* (/ PI F) (/ (- l) F))))
(if (<= (* PI l) -5e-60)
(* PI l)
(if (<= (* PI l) -1e-181)
t_0
(if (<= (* PI l) 5e-248)
(* PI l)
(if (<= (* PI l) 5e-229)
t_0
(if (or (<= (* PI l) 5e-214) (not (<= (* PI l) 1e-112)))
(* PI l)
(* (/ (/ l F) F) (- PI)))))))))
double code(double F, double l) {
double t_0 = (((double) M_PI) / F) * (-l / F);
double tmp;
if ((((double) M_PI) * l) <= -5e-60) {
tmp = ((double) M_PI) * l;
} else if ((((double) M_PI) * l) <= -1e-181) {
tmp = t_0;
} else if ((((double) M_PI) * l) <= 5e-248) {
tmp = ((double) M_PI) * l;
} else if ((((double) M_PI) * l) <= 5e-229) {
tmp = t_0;
} else if (((((double) M_PI) * l) <= 5e-214) || !((((double) M_PI) * l) <= 1e-112)) {
tmp = ((double) M_PI) * l;
} else {
tmp = ((l / F) / F) * -((double) M_PI);
}
return tmp;
}
public static double code(double F, double l) {
double t_0 = (Math.PI / F) * (-l / F);
double tmp;
if ((Math.PI * l) <= -5e-60) {
tmp = Math.PI * l;
} else if ((Math.PI * l) <= -1e-181) {
tmp = t_0;
} else if ((Math.PI * l) <= 5e-248) {
tmp = Math.PI * l;
} else if ((Math.PI * l) <= 5e-229) {
tmp = t_0;
} else if (((Math.PI * l) <= 5e-214) || !((Math.PI * l) <= 1e-112)) {
tmp = Math.PI * l;
} else {
tmp = ((l / F) / F) * -Math.PI;
}
return tmp;
}
def code(F, l): t_0 = (math.pi / F) * (-l / F) tmp = 0 if (math.pi * l) <= -5e-60: tmp = math.pi * l elif (math.pi * l) <= -1e-181: tmp = t_0 elif (math.pi * l) <= 5e-248: tmp = math.pi * l elif (math.pi * l) <= 5e-229: tmp = t_0 elif ((math.pi * l) <= 5e-214) or not ((math.pi * l) <= 1e-112): tmp = math.pi * l else: tmp = ((l / F) / F) * -math.pi return tmp
function code(F, l) t_0 = Float64(Float64(pi / F) * Float64(Float64(-l) / F)) tmp = 0.0 if (Float64(pi * l) <= -5e-60) tmp = Float64(pi * l); elseif (Float64(pi * l) <= -1e-181) tmp = t_0; elseif (Float64(pi * l) <= 5e-248) tmp = Float64(pi * l); elseif (Float64(pi * l) <= 5e-229) tmp = t_0; elseif ((Float64(pi * l) <= 5e-214) || !(Float64(pi * l) <= 1e-112)) tmp = Float64(pi * l); else tmp = Float64(Float64(Float64(l / F) / F) * Float64(-pi)); end return tmp end
function tmp_2 = code(F, l) t_0 = (pi / F) * (-l / F); tmp = 0.0; if ((pi * l) <= -5e-60) tmp = pi * l; elseif ((pi * l) <= -1e-181) tmp = t_0; elseif ((pi * l) <= 5e-248) tmp = pi * l; elseif ((pi * l) <= 5e-229) tmp = t_0; elseif (((pi * l) <= 5e-214) || ~(((pi * l) <= 1e-112))) tmp = pi * l; else tmp = ((l / F) / F) * -pi; end tmp_2 = tmp; end
code[F_, l_] := Block[{t$95$0 = N[(N[(Pi / F), $MachinePrecision] * N[((-l) / F), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(Pi * l), $MachinePrecision], -5e-60], N[(Pi * l), $MachinePrecision], If[LessEqual[N[(Pi * l), $MachinePrecision], -1e-181], t$95$0, If[LessEqual[N[(Pi * l), $MachinePrecision], 5e-248], N[(Pi * l), $MachinePrecision], If[LessEqual[N[(Pi * l), $MachinePrecision], 5e-229], t$95$0, If[Or[LessEqual[N[(Pi * l), $MachinePrecision], 5e-214], N[Not[LessEqual[N[(Pi * l), $MachinePrecision], 1e-112]], $MachinePrecision]], N[(Pi * l), $MachinePrecision], N[(N[(N[(l / F), $MachinePrecision] / F), $MachinePrecision] * (-Pi)), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\pi}{F} \cdot \frac{-\ell}{F}\\
\mathbf{if}\;\pi \cdot \ell \leq -5 \cdot 10^{-60}:\\
\;\;\;\;\pi \cdot \ell\\
\mathbf{elif}\;\pi \cdot \ell \leq -1 \cdot 10^{-181}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\pi \cdot \ell \leq 5 \cdot 10^{-248}:\\
\;\;\;\;\pi \cdot \ell\\
\mathbf{elif}\;\pi \cdot \ell \leq 5 \cdot 10^{-229}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\pi \cdot \ell \leq 5 \cdot 10^{-214} \lor \neg \left(\pi \cdot \ell \leq 10^{-112}\right):\\
\;\;\;\;\pi \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\ell}{F}}{F} \cdot \left(-\pi\right)\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < -5.0000000000000001e-60 or -1.00000000000000005e-181 < (*.f64 (PI.f64) l) < 5.0000000000000001e-248 or 5.00000000000000016e-229 < (*.f64 (PI.f64) l) < 4.9999999999999998e-214 or 9.9999999999999995e-113 < (*.f64 (PI.f64) l) Initial program 73.9%
sqr-neg73.9%
associate-*l/74.2%
*-lft-identity74.2%
sqr-neg74.2%
Simplified74.2%
Taylor expanded in l around 0 60.7%
unpow260.7%
Simplified60.7%
Taylor expanded in F around inf 90.2%
if -5.0000000000000001e-60 < (*.f64 (PI.f64) l) < -1.00000000000000005e-181 or 5.0000000000000001e-248 < (*.f64 (PI.f64) l) < 5.00000000000000016e-229Initial program 73.9%
sqr-neg73.9%
associate-*l/80.8%
*-lft-identity80.8%
sqr-neg80.8%
Simplified80.8%
Taylor expanded in l around 0 74.1%
unpow274.1%
Simplified74.1%
associate-/r*74.1%
div-inv74.1%
Applied egg-rr74.1%
Taylor expanded in F around 0 54.7%
mul-1-neg54.7%
unpow254.7%
Simplified54.7%
*-commutative54.7%
times-frac73.5%
Applied egg-rr73.5%
if 4.9999999999999998e-214 < (*.f64 (PI.f64) l) < 9.9999999999999995e-113Initial program 95.0%
sqr-neg95.0%
associate-*l/95.0%
*-lft-identity95.0%
sqr-neg95.0%
Simplified95.0%
Taylor expanded in l around 0 94.9%
unpow294.9%
Simplified94.9%
associate-/r*94.9%
div-inv95.0%
Applied egg-rr95.0%
Taylor expanded in F around 0 61.9%
mul-1-neg61.9%
unpow261.9%
Simplified61.9%
associate-/r*66.6%
associate-*l/66.7%
associate-/l*66.6%
associate-/r/66.6%
Applied egg-rr66.6%
Final simplification85.8%
(FPCore (F l) :precision binary64 (if (or (<= (* PI l) -50000000000.0) (not (<= (* PI l) 5e-5))) (* PI l) (- (* PI l) (* PI (/ l (* F F))))))
double code(double F, double l) {
double tmp;
if (((((double) M_PI) * l) <= -50000000000.0) || !((((double) M_PI) * l) <= 5e-5)) {
tmp = ((double) M_PI) * l;
} else {
tmp = (((double) M_PI) * l) - (((double) M_PI) * (l / (F * F)));
}
return tmp;
}
public static double code(double F, double l) {
double tmp;
if (((Math.PI * l) <= -50000000000.0) || !((Math.PI * l) <= 5e-5)) {
tmp = Math.PI * l;
} else {
tmp = (Math.PI * l) - (Math.PI * (l / (F * F)));
}
return tmp;
}
def code(F, l): tmp = 0 if ((math.pi * l) <= -50000000000.0) or not ((math.pi * l) <= 5e-5): tmp = math.pi * l else: tmp = (math.pi * l) - (math.pi * (l / (F * F))) return tmp
function code(F, l) tmp = 0.0 if ((Float64(pi * l) <= -50000000000.0) || !(Float64(pi * l) <= 5e-5)) tmp = Float64(pi * l); else tmp = Float64(Float64(pi * l) - Float64(pi * Float64(l / Float64(F * F)))); end return tmp end
function tmp_2 = code(F, l) tmp = 0.0; if (((pi * l) <= -50000000000.0) || ~(((pi * l) <= 5e-5))) tmp = pi * l; else tmp = (pi * l) - (pi * (l / (F * F))); end tmp_2 = tmp; end
code[F_, l_] := If[Or[LessEqual[N[(Pi * l), $MachinePrecision], -50000000000.0], N[Not[LessEqual[N[(Pi * l), $MachinePrecision], 5e-5]], $MachinePrecision]], N[(Pi * l), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] - N[(Pi * N[(l / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\pi \cdot \ell \leq -50000000000 \lor \neg \left(\pi \cdot \ell \leq 5 \cdot 10^{-5}\right):\\
\;\;\;\;\pi \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell - \pi \cdot \frac{\ell}{F \cdot F}\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < -5e10 or 5.00000000000000024e-5 < (*.f64 (PI.f64) l) Initial program 65.0%
sqr-neg65.0%
associate-*l/65.0%
*-lft-identity65.0%
sqr-neg65.0%
Simplified65.0%
Taylor expanded in l around 0 46.0%
unpow246.0%
Simplified46.0%
Taylor expanded in F around inf 96.8%
if -5e10 < (*.f64 (PI.f64) l) < 5.00000000000000024e-5Initial program 86.7%
Taylor expanded in l around 0 88.9%
associate-/l*88.6%
associate-/r/88.9%
unpow288.9%
Simplified88.9%
Final simplification93.0%
(FPCore (F l) :precision binary64 (if (or (<= (* PI l) -50000000000.0) (not (<= (* PI l) 5e-5))) (* PI l) (- (* PI l) (* (/ l F) (/ PI F)))))
double code(double F, double l) {
double tmp;
if (((((double) M_PI) * l) <= -50000000000.0) || !((((double) M_PI) * l) <= 5e-5)) {
tmp = ((double) M_PI) * l;
} else {
tmp = (((double) M_PI) * l) - ((l / F) * (((double) M_PI) / F));
}
return tmp;
}
public static double code(double F, double l) {
double tmp;
if (((Math.PI * l) <= -50000000000.0) || !((Math.PI * l) <= 5e-5)) {
tmp = Math.PI * l;
} else {
tmp = (Math.PI * l) - ((l / F) * (Math.PI / F));
}
return tmp;
}
def code(F, l): tmp = 0 if ((math.pi * l) <= -50000000000.0) or not ((math.pi * l) <= 5e-5): tmp = math.pi * l else: tmp = (math.pi * l) - ((l / F) * (math.pi / F)) return tmp
function code(F, l) tmp = 0.0 if ((Float64(pi * l) <= -50000000000.0) || !(Float64(pi * l) <= 5e-5)) tmp = Float64(pi * l); else tmp = Float64(Float64(pi * l) - Float64(Float64(l / F) * Float64(pi / F))); end return tmp end
function tmp_2 = code(F, l) tmp = 0.0; if (((pi * l) <= -50000000000.0) || ~(((pi * l) <= 5e-5))) tmp = pi * l; else tmp = (pi * l) - ((l / F) * (pi / F)); end tmp_2 = tmp; end
code[F_, l_] := If[Or[LessEqual[N[(Pi * l), $MachinePrecision], -50000000000.0], N[Not[LessEqual[N[(Pi * l), $MachinePrecision], 5e-5]], $MachinePrecision]], N[(Pi * l), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] - N[(N[(l / F), $MachinePrecision] * N[(Pi / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\pi \cdot \ell \leq -50000000000 \lor \neg \left(\pi \cdot \ell \leq 5 \cdot 10^{-5}\right):\\
\;\;\;\;\pi \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell - \frac{\ell}{F} \cdot \frac{\pi}{F}\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < -5e10 or 5.00000000000000024e-5 < (*.f64 (PI.f64) l) Initial program 65.0%
sqr-neg65.0%
associate-*l/65.0%
*-lft-identity65.0%
sqr-neg65.0%
Simplified65.0%
Taylor expanded in l around 0 46.0%
unpow246.0%
Simplified46.0%
Taylor expanded in F around inf 96.8%
if -5e10 < (*.f64 (PI.f64) l) < 5.00000000000000024e-5Initial program 86.7%
sqr-neg86.7%
associate-*l/89.5%
*-lft-identity89.5%
sqr-neg89.5%
Simplified89.5%
add-cbrt-cube64.9%
pow1/345.7%
pow345.7%
pow-to-exp28.6%
pow-exp43.1%
Applied egg-rr43.1%
Taylor expanded in l around 0 88.9%
*-commutative88.9%
unpow288.9%
times-frac99.0%
Simplified99.0%
Final simplification97.8%
(FPCore (F l) :precision binary64 (if (or (<= (* PI l) -50000000000.0) (not (<= (* PI l) 5e-5))) (* PI l) (- (* PI l) (/ (* PI (/ l F)) F))))
double code(double F, double l) {
double tmp;
if (((((double) M_PI) * l) <= -50000000000.0) || !((((double) M_PI) * l) <= 5e-5)) {
tmp = ((double) M_PI) * l;
} else {
tmp = (((double) M_PI) * l) - ((((double) M_PI) * (l / F)) / F);
}
return tmp;
}
public static double code(double F, double l) {
double tmp;
if (((Math.PI * l) <= -50000000000.0) || !((Math.PI * l) <= 5e-5)) {
tmp = Math.PI * l;
} else {
tmp = (Math.PI * l) - ((Math.PI * (l / F)) / F);
}
return tmp;
}
def code(F, l): tmp = 0 if ((math.pi * l) <= -50000000000.0) or not ((math.pi * l) <= 5e-5): tmp = math.pi * l else: tmp = (math.pi * l) - ((math.pi * (l / F)) / F) return tmp
function code(F, l) tmp = 0.0 if ((Float64(pi * l) <= -50000000000.0) || !(Float64(pi * l) <= 5e-5)) tmp = Float64(pi * l); else tmp = Float64(Float64(pi * l) - Float64(Float64(pi * Float64(l / F)) / F)); end return tmp end
function tmp_2 = code(F, l) tmp = 0.0; if (((pi * l) <= -50000000000.0) || ~(((pi * l) <= 5e-5))) tmp = pi * l; else tmp = (pi * l) - ((pi * (l / F)) / F); end tmp_2 = tmp; end
code[F_, l_] := If[Or[LessEqual[N[(Pi * l), $MachinePrecision], -50000000000.0], N[Not[LessEqual[N[(Pi * l), $MachinePrecision], 5e-5]], $MachinePrecision]], N[(Pi * l), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] - N[(N[(Pi * N[(l / F), $MachinePrecision]), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\pi \cdot \ell \leq -50000000000 \lor \neg \left(\pi \cdot \ell \leq 5 \cdot 10^{-5}\right):\\
\;\;\;\;\pi \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell - \frac{\pi \cdot \frac{\ell}{F}}{F}\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < -5e10 or 5.00000000000000024e-5 < (*.f64 (PI.f64) l) Initial program 65.0%
sqr-neg65.0%
associate-*l/65.0%
*-lft-identity65.0%
sqr-neg65.0%
Simplified65.0%
Taylor expanded in l around 0 46.0%
unpow246.0%
Simplified46.0%
Taylor expanded in F around inf 96.8%
if -5e10 < (*.f64 (PI.f64) l) < 5.00000000000000024e-5Initial program 86.7%
associate-*l/89.5%
*-un-lft-identity89.5%
associate-/r*99.6%
Applied egg-rr99.6%
Taylor expanded in l around 0 99.0%
associate-/l*99.0%
associate-/r/99.1%
Simplified99.1%
Final simplification97.9%
(FPCore (F l) :precision binary64 (if (or (<= (* PI l) -50000000000.0) (not (<= (* PI l) 5e-5))) (* PI l) (* l (- PI (/ PI (* F F))))))
double code(double F, double l) {
double tmp;
if (((((double) M_PI) * l) <= -50000000000.0) || !((((double) M_PI) * l) <= 5e-5)) {
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 (((Math.PI * l) <= -50000000000.0) || !((Math.PI * l) <= 5e-5)) {
tmp = Math.PI * l;
} else {
tmp = l * (Math.PI - (Math.PI / (F * F)));
}
return tmp;
}
def code(F, l): tmp = 0 if ((math.pi * l) <= -50000000000.0) or not ((math.pi * l) <= 5e-5): tmp = math.pi * l else: tmp = l * (math.pi - (math.pi / (F * F))) return tmp
function code(F, l) tmp = 0.0 if ((Float64(pi * l) <= -50000000000.0) || !(Float64(pi * l) <= 5e-5)) 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 (((pi * l) <= -50000000000.0) || ~(((pi * l) <= 5e-5))) tmp = pi * l; else tmp = l * (pi - (pi / (F * F))); end tmp_2 = tmp; end
code[F_, l_] := If[Or[LessEqual[N[(Pi * l), $MachinePrecision], -50000000000.0], N[Not[LessEqual[N[(Pi * l), $MachinePrecision], 5e-5]], $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}\;\pi \cdot \ell \leq -50000000000 \lor \neg \left(\pi \cdot \ell \leq 5 \cdot 10^{-5}\right):\\
\;\;\;\;\pi \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;\ell \cdot \left(\pi - \frac{\pi}{F \cdot F}\right)\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < -5e10 or 5.00000000000000024e-5 < (*.f64 (PI.f64) l) Initial program 65.0%
sqr-neg65.0%
associate-*l/65.0%
*-lft-identity65.0%
sqr-neg65.0%
Simplified65.0%
Taylor expanded in l around 0 46.0%
unpow246.0%
Simplified46.0%
Taylor expanded in F around inf 96.8%
if -5e10 < (*.f64 (PI.f64) l) < 5.00000000000000024e-5Initial program 86.7%
sqr-neg86.7%
associate-*l/89.5%
*-lft-identity89.5%
sqr-neg89.5%
Simplified89.5%
Taylor expanded in l around 0 86.2%
unpow286.2%
Simplified86.2%
Final simplification91.6%
(FPCore (F l)
:precision binary64
(if (or (<= l -5.3e-61)
(and (not (<= l -4e-182))
(or (<= l 3e-248)
(not
(or (<= l 3.8e-227)
(and (not (<= l 5.2e-214)) (<= l 3.6e-111)))))))
(* PI l)
(* (/ PI F) (/ (- l) F))))
double code(double F, double l) {
double tmp;
if ((l <= -5.3e-61) || (!(l <= -4e-182) && ((l <= 3e-248) || !((l <= 3.8e-227) || (!(l <= 5.2e-214) && (l <= 3.6e-111)))))) {
tmp = ((double) M_PI) * l;
} else {
tmp = (((double) M_PI) / F) * (-l / F);
}
return tmp;
}
public static double code(double F, double l) {
double tmp;
if ((l <= -5.3e-61) || (!(l <= -4e-182) && ((l <= 3e-248) || !((l <= 3.8e-227) || (!(l <= 5.2e-214) && (l <= 3.6e-111)))))) {
tmp = Math.PI * l;
} else {
tmp = (Math.PI / F) * (-l / F);
}
return tmp;
}
def code(F, l): tmp = 0 if (l <= -5.3e-61) or (not (l <= -4e-182) and ((l <= 3e-248) or not ((l <= 3.8e-227) or (not (l <= 5.2e-214) and (l <= 3.6e-111))))): tmp = math.pi * l else: tmp = (math.pi / F) * (-l / F) return tmp
function code(F, l) tmp = 0.0 if ((l <= -5.3e-61) || (!(l <= -4e-182) && ((l <= 3e-248) || !((l <= 3.8e-227) || (!(l <= 5.2e-214) && (l <= 3.6e-111)))))) tmp = Float64(pi * l); else tmp = Float64(Float64(pi / F) * Float64(Float64(-l) / F)); end return tmp end
function tmp_2 = code(F, l) tmp = 0.0; if ((l <= -5.3e-61) || (~((l <= -4e-182)) && ((l <= 3e-248) || ~(((l <= 3.8e-227) || (~((l <= 5.2e-214)) && (l <= 3.6e-111))))))) tmp = pi * l; else tmp = (pi / F) * (-l / F); end tmp_2 = tmp; end
code[F_, l_] := If[Or[LessEqual[l, -5.3e-61], And[N[Not[LessEqual[l, -4e-182]], $MachinePrecision], Or[LessEqual[l, 3e-248], N[Not[Or[LessEqual[l, 3.8e-227], And[N[Not[LessEqual[l, 5.2e-214]], $MachinePrecision], LessEqual[l, 3.6e-111]]]], $MachinePrecision]]]], N[(Pi * l), $MachinePrecision], N[(N[(Pi / F), $MachinePrecision] * N[((-l) / F), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5.3 \cdot 10^{-61} \lor \neg \left(\ell \leq -4 \cdot 10^{-182}\right) \land \left(\ell \leq 3 \cdot 10^{-248} \lor \neg \left(\ell \leq 3.8 \cdot 10^{-227} \lor \neg \left(\ell \leq 5.2 \cdot 10^{-214}\right) \land \ell \leq 3.6 \cdot 10^{-111}\right)\right):\\
\;\;\;\;\pi \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;\frac{\pi}{F} \cdot \frac{-\ell}{F}\\
\end{array}
\end{array}
if l < -5.3e-61 or -4.0000000000000002e-182 < l < 3.00000000000000014e-248 or 3.8000000000000001e-227 < l < 5.2e-214 or 3.6000000000000001e-111 < l Initial program 73.9%
sqr-neg73.9%
associate-*l/74.2%
*-lft-identity74.2%
sqr-neg74.2%
Simplified74.2%
Taylor expanded in l around 0 60.7%
unpow260.7%
Simplified60.7%
Taylor expanded in F around inf 90.2%
if -5.3e-61 < l < -4.0000000000000002e-182 or 3.00000000000000014e-248 < l < 3.8000000000000001e-227 or 5.2e-214 < l < 3.6000000000000001e-111Initial program 81.0%
sqr-neg81.0%
associate-*l/85.6%
*-lft-identity85.6%
sqr-neg85.6%
Simplified85.6%
Taylor expanded in l around 0 81.0%
unpow281.0%
Simplified81.0%
associate-/r*81.0%
div-inv81.0%
Applied egg-rr81.0%
Taylor expanded in F around 0 57.1%
mul-1-neg57.1%
unpow257.1%
Simplified57.1%
*-commutative57.1%
times-frac71.1%
Applied egg-rr71.1%
Final simplification85.7%
(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 75.5%
sqr-neg75.5%
associate-*l/76.8%
*-lft-identity76.8%
sqr-neg76.8%
Simplified76.8%
Taylor expanded in l around 0 65.5%
unpow265.5%
Simplified65.5%
Taylor expanded in F around inf 76.2%
Final simplification76.2%
herbie shell --seed 2023263
(FPCore (F l)
:name "VandenBroeck and Keller, Equation (6)"
:precision binary64
(- (* PI l) (* (/ 1.0 (* F F)) (tan (* PI l)))))