
(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) -2e+20) (not (<= (* PI l) 1e-10))) (* PI l) (- (* PI l) (/ -1.0 (* F (/ (- F) (tan (* PI l))))))))
double code(double F, double l) {
double tmp;
if (((((double) M_PI) * l) <= -2e+20) || !((((double) M_PI) * l) <= 1e-10)) {
tmp = ((double) M_PI) * l;
} else {
tmp = (((double) M_PI) * l) - (-1.0 / (F * (-F / tan((((double) M_PI) * l)))));
}
return tmp;
}
public static double code(double F, double l) {
double tmp;
if (((Math.PI * l) <= -2e+20) || !((Math.PI * l) <= 1e-10)) {
tmp = Math.PI * l;
} else {
tmp = (Math.PI * l) - (-1.0 / (F * (-F / Math.tan((Math.PI * l)))));
}
return tmp;
}
def code(F, l): tmp = 0 if ((math.pi * l) <= -2e+20) or not ((math.pi * l) <= 1e-10): tmp = math.pi * l else: tmp = (math.pi * l) - (-1.0 / (F * (-F / math.tan((math.pi * l))))) return tmp
function code(F, l) tmp = 0.0 if ((Float64(pi * l) <= -2e+20) || !(Float64(pi * l) <= 1e-10)) tmp = Float64(pi * l); else tmp = Float64(Float64(pi * l) - Float64(-1.0 / Float64(F * Float64(Float64(-F) / tan(Float64(pi * l)))))); end return tmp end
function tmp_2 = code(F, l) tmp = 0.0; if (((pi * l) <= -2e+20) || ~(((pi * l) <= 1e-10))) tmp = pi * l; else tmp = (pi * l) - (-1.0 / (F * (-F / tan((pi * l))))); end tmp_2 = tmp; end
code[F_, l_] := If[Or[LessEqual[N[(Pi * l), $MachinePrecision], -2e+20], N[Not[LessEqual[N[(Pi * l), $MachinePrecision], 1e-10]], $MachinePrecision]], N[(Pi * l), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] - N[(-1.0 / N[(F * N[((-F) / N[Tan[N[(Pi * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\pi \cdot \ell \leq -2 \cdot 10^{+20} \lor \neg \left(\pi \cdot \ell \leq 10^{-10}\right):\\
\;\;\;\;\pi \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell - \frac{-1}{F \cdot \frac{-F}{\tan \left(\pi \cdot \ell\right)}}\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < -2e20 or 1.00000000000000004e-10 < (*.f64 (PI.f64) l) Initial program 71.3%
Taylor expanded in l around 0 56.7%
associate-/l*56.7%
unpow256.7%
Simplified56.7%
Taylor expanded in l around 0 56.7%
unpow256.7%
times-frac56.7%
Simplified56.7%
Taylor expanded in F around inf 99.5%
if -2e20 < (*.f64 (PI.f64) l) < 1.00000000000000004e-10Initial program 86.4%
Taylor expanded in F around 0 86.4%
unpow-186.4%
exp-to-pow40.2%
exp-prod40.2%
associate-*l*40.2%
metadata-eval40.2%
exp-to-pow86.4%
Simplified86.4%
metadata-eval86.4%
pow-flip86.4%
pow286.4%
associate-/r/87.0%
frac-2neg87.0%
metadata-eval87.0%
associate-*l/99.2%
*-commutative99.2%
distribute-lft-neg-in99.2%
Applied egg-rr99.2%
Final simplification99.3%
(FPCore (F l)
:precision binary64
(let* ((t_0 (* (pow PI 5.0) -0.03333333333333333))
(t_1 (* (pow PI 3.0) 0.3333333333333333))
(t_2 (* t_1 (* -0.5 (pow PI 2.0))))
(t_3 (- t_0 t_2))
(t_4
(- (/ F (/ (pow PI 2.0) t_3)) (/ F (/ (pow PI 3.0) (pow t_1 2.0))))))
(-
(* PI l)
(/
-1.0
(*
F
(-
(/ F (/ (pow PI 2.0) (* (pow PI 3.0) (* l 0.3333333333333333))))
(fma
-1.0
(fma
(+
(-
(/
(-
(* -0.0001984126984126984 (pow PI 7.0))
(fma
0.041666666666666664
(* (pow PI 3.0) (* 0.3333333333333333 (pow PI 4.0)))
(fma
-0.5
(* (pow PI 2.0) t_3)
(* (pow PI 7.0) -0.001388888888888889))))
(/ (pow PI 2.0) F))
(/ t_1 (/ PI t_4)))
(/ (* (* F t_1) (- t_2 t_0)) (pow PI 3.0)))
(pow l 5.0)
(* t_4 (pow l 3.0)))
(/ F (* PI l)))))))))
double code(double F, double l) {
double t_0 = pow(((double) M_PI), 5.0) * -0.03333333333333333;
double t_1 = pow(((double) M_PI), 3.0) * 0.3333333333333333;
double t_2 = t_1 * (-0.5 * pow(((double) M_PI), 2.0));
double t_3 = t_0 - t_2;
double t_4 = (F / (pow(((double) M_PI), 2.0) / t_3)) - (F / (pow(((double) M_PI), 3.0) / pow(t_1, 2.0)));
return (((double) M_PI) * l) - (-1.0 / (F * ((F / (pow(((double) M_PI), 2.0) / (pow(((double) M_PI), 3.0) * (l * 0.3333333333333333)))) - fma(-1.0, fma((((((-0.0001984126984126984 * pow(((double) M_PI), 7.0)) - fma(0.041666666666666664, (pow(((double) M_PI), 3.0) * (0.3333333333333333 * pow(((double) M_PI), 4.0))), fma(-0.5, (pow(((double) M_PI), 2.0) * t_3), (pow(((double) M_PI), 7.0) * -0.001388888888888889)))) / (pow(((double) M_PI), 2.0) / F)) - (t_1 / (((double) M_PI) / t_4))) + (((F * t_1) * (t_2 - t_0)) / pow(((double) M_PI), 3.0))), pow(l, 5.0), (t_4 * pow(l, 3.0))), (F / (((double) M_PI) * l))))));
}
function code(F, l) t_0 = Float64((pi ^ 5.0) * -0.03333333333333333) t_1 = Float64((pi ^ 3.0) * 0.3333333333333333) t_2 = Float64(t_1 * Float64(-0.5 * (pi ^ 2.0))) t_3 = Float64(t_0 - t_2) t_4 = Float64(Float64(F / Float64((pi ^ 2.0) / t_3)) - Float64(F / Float64((pi ^ 3.0) / (t_1 ^ 2.0)))) return Float64(Float64(pi * l) - Float64(-1.0 / Float64(F * Float64(Float64(F / Float64((pi ^ 2.0) / Float64((pi ^ 3.0) * Float64(l * 0.3333333333333333)))) - fma(-1.0, fma(Float64(Float64(Float64(Float64(Float64(-0.0001984126984126984 * (pi ^ 7.0)) - fma(0.041666666666666664, Float64((pi ^ 3.0) * Float64(0.3333333333333333 * (pi ^ 4.0))), fma(-0.5, Float64((pi ^ 2.0) * t_3), Float64((pi ^ 7.0) * -0.001388888888888889)))) / Float64((pi ^ 2.0) / F)) - Float64(t_1 / Float64(pi / t_4))) + Float64(Float64(Float64(F * t_1) * Float64(t_2 - t_0)) / (pi ^ 3.0))), (l ^ 5.0), Float64(t_4 * (l ^ 3.0))), Float64(F / Float64(pi * l))))))) end
code[F_, l_] := Block[{t$95$0 = N[(N[Power[Pi, 5.0], $MachinePrecision] * -0.03333333333333333), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[Pi, 3.0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[(-0.5 * N[Power[Pi, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$0 - t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(N[(F / N[(N[Power[Pi, 2.0], $MachinePrecision] / t$95$3), $MachinePrecision]), $MachinePrecision] - N[(F / N[(N[Power[Pi, 3.0], $MachinePrecision] / N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[(Pi * l), $MachinePrecision] - N[(-1.0 / N[(F * N[(N[(F / N[(N[Power[Pi, 2.0], $MachinePrecision] / N[(N[Power[Pi, 3.0], $MachinePrecision] * N[(l * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(-1.0 * N[(N[(N[(N[(N[(N[(-0.0001984126984126984 * N[Power[Pi, 7.0], $MachinePrecision]), $MachinePrecision] - N[(0.041666666666666664 * N[(N[Power[Pi, 3.0], $MachinePrecision] * N[(0.3333333333333333 * N[Power[Pi, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(N[Power[Pi, 2.0], $MachinePrecision] * t$95$3), $MachinePrecision] + N[(N[Power[Pi, 7.0], $MachinePrecision] * -0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Power[Pi, 2.0], $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision] - N[(t$95$1 / N[(Pi / t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(F * t$95$1), $MachinePrecision] * N[(t$95$2 - t$95$0), $MachinePrecision]), $MachinePrecision] / N[Power[Pi, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Power[l, 5.0], $MachinePrecision] + N[(t$95$4 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(F / N[(Pi * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\pi}^{5} \cdot -0.03333333333333333\\
t_1 := {\pi}^{3} \cdot 0.3333333333333333\\
t_2 := t_1 \cdot \left(-0.5 \cdot {\pi}^{2}\right)\\
t_3 := t_0 - t_2\\
t_4 := \frac{F}{\frac{{\pi}^{2}}{t_3}} - \frac{F}{\frac{{\pi}^{3}}{{t_1}^{2}}}\\
\pi \cdot \ell - \frac{-1}{F \cdot \left(\frac{F}{\frac{{\pi}^{2}}{{\pi}^{3} \cdot \left(\ell \cdot 0.3333333333333333\right)}} - \mathsf{fma}\left(-1, \mathsf{fma}\left(\left(\frac{-0.0001984126984126984 \cdot {\pi}^{7} - \mathsf{fma}\left(0.041666666666666664, {\pi}^{3} \cdot \left(0.3333333333333333 \cdot {\pi}^{4}\right), \mathsf{fma}\left(-0.5, {\pi}^{2} \cdot t_3, {\pi}^{7} \cdot -0.001388888888888889\right)\right)}{\frac{{\pi}^{2}}{F}} - \frac{t_1}{\frac{\pi}{t_4}}\right) + \frac{\left(F \cdot t_1\right) \cdot \left(t_2 - t_0\right)}{{\pi}^{3}}, {\ell}^{5}, t_4 \cdot {\ell}^{3}\right), \frac{F}{\pi \cdot \ell}\right)\right)}
\end{array}
\end{array}
Initial program 79.5%
Taylor expanded in F around 0 79.5%
unpow-179.5%
exp-to-pow37.1%
exp-prod37.1%
associate-*l*37.1%
metadata-eval37.1%
exp-to-pow79.4%
Simplified79.4%
metadata-eval79.4%
pow-flip79.5%
pow279.5%
associate-/r/79.8%
frac-2neg79.8%
metadata-eval79.8%
associate-*l/86.4%
*-commutative86.4%
distribute-lft-neg-in86.4%
Applied egg-rr86.4%
Taylor expanded in l around 0 97.0%
Simplified97.0%
Final simplification97.0%
(FPCore (F l) :precision binary64 (if (or (<= (* PI l) -2e+20) (not (<= (* PI l) 1e-10))) (* PI l) (+ (* PI l) (/ -1.0 (/ F (/ (tan (* PI l)) F))))))
double code(double F, double l) {
double tmp;
if (((((double) M_PI) * l) <= -2e+20) || !((((double) M_PI) * l) <= 1e-10)) {
tmp = ((double) M_PI) * l;
} else {
tmp = (((double) M_PI) * l) + (-1.0 / (F / (tan((((double) M_PI) * l)) / F)));
}
return tmp;
}
public static double code(double F, double l) {
double tmp;
if (((Math.PI * l) <= -2e+20) || !((Math.PI * l) <= 1e-10)) {
tmp = Math.PI * l;
} else {
tmp = (Math.PI * l) + (-1.0 / (F / (Math.tan((Math.PI * l)) / F)));
}
return tmp;
}
def code(F, l): tmp = 0 if ((math.pi * l) <= -2e+20) or not ((math.pi * l) <= 1e-10): tmp = math.pi * l else: tmp = (math.pi * l) + (-1.0 / (F / (math.tan((math.pi * l)) / F))) return tmp
function code(F, l) tmp = 0.0 if ((Float64(pi * l) <= -2e+20) || !(Float64(pi * l) <= 1e-10)) tmp = Float64(pi * l); else tmp = Float64(Float64(pi * l) + Float64(-1.0 / Float64(F / Float64(tan(Float64(pi * l)) / F)))); end return tmp end
function tmp_2 = code(F, l) tmp = 0.0; if (((pi * l) <= -2e+20) || ~(((pi * l) <= 1e-10))) tmp = pi * l; else tmp = (pi * l) + (-1.0 / (F / (tan((pi * l)) / F))); end tmp_2 = tmp; end
code[F_, l_] := If[Or[LessEqual[N[(Pi * l), $MachinePrecision], -2e+20], N[Not[LessEqual[N[(Pi * l), $MachinePrecision], 1e-10]], $MachinePrecision]], N[(Pi * l), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] + N[(-1.0 / N[(F / N[(N[Tan[N[(Pi * l), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\pi \cdot \ell \leq -2 \cdot 10^{+20} \lor \neg \left(\pi \cdot \ell \leq 10^{-10}\right):\\
\;\;\;\;\pi \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell + \frac{-1}{\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}}\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < -2e20 or 1.00000000000000004e-10 < (*.f64 (PI.f64) l) Initial program 71.3%
Taylor expanded in l around 0 56.7%
associate-/l*56.7%
unpow256.7%
Simplified56.7%
Taylor expanded in l around 0 56.7%
unpow256.7%
times-frac56.7%
Simplified56.7%
Taylor expanded in F around inf 99.5%
if -2e20 < (*.f64 (PI.f64) l) < 1.00000000000000004e-10Initial program 86.4%
associate-/r/87.0%
associate-/l*99.2%
Applied egg-rr99.2%
Final simplification99.3%
(FPCore (F l) :precision binary64 (if (or (<= (* PI l) -2e+20) (not (<= (* PI l) 1e-10))) (* PI l) (+ (* PI l) (/ (/ -1.0 F) (/ F (tan (* PI l)))))))
double code(double F, double l) {
double tmp;
if (((((double) M_PI) * l) <= -2e+20) || !((((double) M_PI) * l) <= 1e-10)) {
tmp = ((double) M_PI) * l;
} else {
tmp = (((double) M_PI) * l) + ((-1.0 / F) / (F / tan((((double) M_PI) * l))));
}
return tmp;
}
public static double code(double F, double l) {
double tmp;
if (((Math.PI * l) <= -2e+20) || !((Math.PI * l) <= 1e-10)) {
tmp = Math.PI * l;
} else {
tmp = (Math.PI * l) + ((-1.0 / F) / (F / Math.tan((Math.PI * l))));
}
return tmp;
}
def code(F, l): tmp = 0 if ((math.pi * l) <= -2e+20) or not ((math.pi * l) <= 1e-10): tmp = math.pi * l else: tmp = (math.pi * l) + ((-1.0 / F) / (F / math.tan((math.pi * l)))) return tmp
function code(F, l) tmp = 0.0 if ((Float64(pi * l) <= -2e+20) || !(Float64(pi * l) <= 1e-10)) tmp = Float64(pi * l); else tmp = Float64(Float64(pi * l) + Float64(Float64(-1.0 / F) / Float64(F / tan(Float64(pi * l))))); end return tmp end
function tmp_2 = code(F, l) tmp = 0.0; if (((pi * l) <= -2e+20) || ~(((pi * l) <= 1e-10))) tmp = pi * l; else tmp = (pi * l) + ((-1.0 / F) / (F / tan((pi * l)))); end tmp_2 = tmp; end
code[F_, l_] := If[Or[LessEqual[N[(Pi * l), $MachinePrecision], -2e+20], N[Not[LessEqual[N[(Pi * l), $MachinePrecision], 1e-10]], $MachinePrecision]], N[(Pi * l), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] + N[(N[(-1.0 / F), $MachinePrecision] / N[(F / N[Tan[N[(Pi * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\pi \cdot \ell \leq -2 \cdot 10^{+20} \lor \neg \left(\pi \cdot \ell \leq 10^{-10}\right):\\
\;\;\;\;\pi \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell + \frac{\frac{-1}{F}}{\frac{F}{\tan \left(\pi \cdot \ell\right)}}\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < -2e20 or 1.00000000000000004e-10 < (*.f64 (PI.f64) l) Initial program 71.3%
Taylor expanded in l around 0 56.7%
associate-/l*56.7%
unpow256.7%
Simplified56.7%
Taylor expanded in l around 0 56.7%
unpow256.7%
times-frac56.7%
Simplified56.7%
Taylor expanded in F around inf 99.5%
if -2e20 < (*.f64 (PI.f64) l) < 1.00000000000000004e-10Initial program 86.4%
Taylor expanded in F around 0 86.4%
unpow-186.4%
exp-to-pow40.2%
exp-prod40.2%
associate-*l*40.2%
metadata-eval40.2%
exp-to-pow86.4%
Simplified86.4%
metadata-eval86.4%
pow-prod-up86.4%
inv-pow86.4%
inv-pow86.4%
associate-*l*99.0%
associate-/r/99.2%
un-div-inv99.2%
Applied egg-rr99.2%
Final simplification99.3%
(FPCore (F l) :precision binary64 (if (or (<= (* PI l) -2e+20) (not (<= (* PI l) 1e-10))) (* PI l) (- (* PI l) (/ (/ (tan (* PI l)) F) F))))
double code(double F, double l) {
double tmp;
if (((((double) M_PI) * l) <= -2e+20) || !((((double) M_PI) * l) <= 1e-10)) {
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+20) || !((Math.PI * l) <= 1e-10)) {
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+20) or not ((math.pi * l) <= 1e-10): 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+20) || !(Float64(pi * l) <= 1e-10)) 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+20) || ~(((pi * l) <= 1e-10))) 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+20], N[Not[LessEqual[N[(Pi * l), $MachinePrecision], 1e-10]], $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^{+20} \lor \neg \left(\pi \cdot \ell \leq 10^{-10}\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) < -2e20 or 1.00000000000000004e-10 < (*.f64 (PI.f64) l) Initial program 71.3%
Taylor expanded in l around 0 56.7%
associate-/l*56.7%
unpow256.7%
Simplified56.7%
Taylor expanded in l around 0 56.7%
unpow256.7%
times-frac56.7%
Simplified56.7%
Taylor expanded in F around inf 99.5%
if -2e20 < (*.f64 (PI.f64) l) < 1.00000000000000004e-10Initial program 86.4%
associate-*l/87.0%
*-un-lft-identity87.0%
associate-/r*99.1%
Applied egg-rr99.1%
Final simplification99.3%
(FPCore (F l) :precision binary64 (if (or (<= (* PI l) -5.0) (not (<= (* PI l) 1e-10))) (* PI l) (- (* PI l) (* (/ l F) (/ PI F)))))
double code(double F, double l) {
double tmp;
if (((((double) M_PI) * l) <= -5.0) || !((((double) M_PI) * l) <= 1e-10)) {
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) <= -5.0) || !((Math.PI * l) <= 1e-10)) {
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) <= -5.0) or not ((math.pi * l) <= 1e-10): 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) <= -5.0) || !(Float64(pi * l) <= 1e-10)) 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) <= -5.0) || ~(((pi * l) <= 1e-10))) 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], -5.0], N[Not[LessEqual[N[(Pi * l), $MachinePrecision], 1e-10]], $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 -5 \lor \neg \left(\pi \cdot \ell \leq 10^{-10}\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) < -5 or 1.00000000000000004e-10 < (*.f64 (PI.f64) l) Initial program 71.6%
Taylor expanded in l around 0 56.2%
associate-/l*56.2%
unpow256.2%
Simplified56.2%
Taylor expanded in l around 0 56.2%
unpow256.2%
times-frac56.2%
Simplified56.2%
Taylor expanded in F around inf 98.0%
if -5 < (*.f64 (PI.f64) l) < 1.00000000000000004e-10Initial program 86.5%
Taylor expanded in l around 0 87.1%
associate-/l*87.1%
unpow287.1%
Simplified87.1%
Taylor expanded in l around 0 87.1%
unpow287.1%
times-frac99.6%
Simplified99.6%
Final simplification98.8%
(FPCore (F l)
:precision binary64
(let* ((t_0 (* l (- PI (/ PI (* F F))))))
(if (<= l -0.5)
(* PI l)
(if (<= l 5.1e-220)
t_0
(if (<= l 2.5e-145)
(* (/ PI F) (/ (- l) F))
(if (<= l 0.5) t_0 (* PI l)))))))
double code(double F, double l) {
double t_0 = l * (((double) M_PI) - (((double) M_PI) / (F * F)));
double tmp;
if (l <= -0.5) {
tmp = ((double) M_PI) * l;
} else if (l <= 5.1e-220) {
tmp = t_0;
} else if (l <= 2.5e-145) {
tmp = (((double) M_PI) / F) * (-l / F);
} else if (l <= 0.5) {
tmp = t_0;
} else {
tmp = ((double) M_PI) * l;
}
return tmp;
}
public static double code(double F, double l) {
double t_0 = l * (Math.PI - (Math.PI / (F * F)));
double tmp;
if (l <= -0.5) {
tmp = Math.PI * l;
} else if (l <= 5.1e-220) {
tmp = t_0;
} else if (l <= 2.5e-145) {
tmp = (Math.PI / F) * (-l / F);
} else if (l <= 0.5) {
tmp = t_0;
} else {
tmp = Math.PI * l;
}
return tmp;
}
def code(F, l): t_0 = l * (math.pi - (math.pi / (F * F))) tmp = 0 if l <= -0.5: tmp = math.pi * l elif l <= 5.1e-220: tmp = t_0 elif l <= 2.5e-145: tmp = (math.pi / F) * (-l / F) elif l <= 0.5: tmp = t_0 else: tmp = math.pi * l return tmp
function code(F, l) t_0 = Float64(l * Float64(pi - Float64(pi / Float64(F * F)))) tmp = 0.0 if (l <= -0.5) tmp = Float64(pi * l); elseif (l <= 5.1e-220) tmp = t_0; elseif (l <= 2.5e-145) tmp = Float64(Float64(pi / F) * Float64(Float64(-l) / F)); elseif (l <= 0.5) tmp = t_0; else tmp = Float64(pi * l); end return tmp end
function tmp_2 = code(F, l) t_0 = l * (pi - (pi / (F * F))); tmp = 0.0; if (l <= -0.5) tmp = pi * l; elseif (l <= 5.1e-220) tmp = t_0; elseif (l <= 2.5e-145) tmp = (pi / F) * (-l / F); elseif (l <= 0.5) tmp = t_0; else tmp = pi * l; end tmp_2 = tmp; end
code[F_, l_] := Block[{t$95$0 = N[(l * N[(Pi - N[(Pi / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -0.5], N[(Pi * l), $MachinePrecision], If[LessEqual[l, 5.1e-220], t$95$0, If[LessEqual[l, 2.5e-145], N[(N[(Pi / F), $MachinePrecision] * N[((-l) / F), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 0.5], t$95$0, N[(Pi * l), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \ell \cdot \left(\pi - \frac{\pi}{F \cdot F}\right)\\
\mathbf{if}\;\ell \leq -0.5:\\
\;\;\;\;\pi \cdot \ell\\
\mathbf{elif}\;\ell \leq 5.1 \cdot 10^{-220}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 2.5 \cdot 10^{-145}:\\
\;\;\;\;\frac{\pi}{F} \cdot \frac{-\ell}{F}\\
\mathbf{elif}\;\ell \leq 0.5:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell\\
\end{array}
\end{array}
if l < -0.5 or 0.5 < l Initial program 71.6%
Taylor expanded in l around 0 56.2%
associate-/l*56.2%
unpow256.2%
Simplified56.2%
Taylor expanded in l around 0 56.2%
unpow256.2%
times-frac56.2%
Simplified56.2%
Taylor expanded in F around inf 98.0%
if -0.5 < l < 5.1000000000000001e-220 or 2.4999999999999999e-145 < l < 0.5Initial program 91.5%
Taylor expanded in l around 0 91.5%
associate-/l*91.5%
unpow291.5%
Simplified91.5%
Taylor expanded in l around 0 91.5%
unpow291.5%
times-frac99.6%
Simplified99.6%
Taylor expanded in l around 0 91.4%
remove-double-neg91.4%
mul-1-neg91.4%
distribute-lft-out--91.4%
mul-1-neg91.4%
mul-1-neg91.4%
distribute-lft-out--91.4%
mul-1-neg91.4%
remove-double-neg91.4%
unpow291.4%
Simplified91.4%
if 5.1000000000000001e-220 < l < 2.4999999999999999e-145Initial program 57.8%
Taylor expanded in l around 0 62.1%
associate-/l*61.7%
unpow261.7%
Simplified61.7%
Taylor expanded in l around 0 62.1%
unpow262.1%
times-frac99.7%
Simplified99.7%
Taylor expanded in F around 0 43.1%
unpow243.1%
times-frac80.7%
neg-mul-180.7%
distribute-rgt-neg-in80.7%
distribute-neg-frac80.7%
Simplified80.7%
Final simplification93.7%
(FPCore (F l)
:precision binary64
(if (or (<= (* F F) 5e-301)
(and (not (<= (* F F) 2e-274)) (<= (* F F) 2e-47)))
(* (/ l F) (/ (- PI) F))
(* PI l)))
double code(double F, double l) {
double tmp;
if (((F * F) <= 5e-301) || (!((F * F) <= 2e-274) && ((F * F) <= 2e-47))) {
tmp = (l / F) * (-((double) M_PI) / F);
} else {
tmp = ((double) M_PI) * l;
}
return tmp;
}
public static double code(double F, double l) {
double tmp;
if (((F * F) <= 5e-301) || (!((F * F) <= 2e-274) && ((F * F) <= 2e-47))) {
tmp = (l / F) * (-Math.PI / F);
} else {
tmp = Math.PI * l;
}
return tmp;
}
def code(F, l): tmp = 0 if ((F * F) <= 5e-301) or (not ((F * F) <= 2e-274) and ((F * F) <= 2e-47)): tmp = (l / F) * (-math.pi / F) else: tmp = math.pi * l return tmp
function code(F, l) tmp = 0.0 if ((Float64(F * F) <= 5e-301) || (!(Float64(F * F) <= 2e-274) && (Float64(F * F) <= 2e-47))) tmp = Float64(Float64(l / F) * Float64(Float64(-pi) / F)); else tmp = Float64(pi * l); end return tmp end
function tmp_2 = code(F, l) tmp = 0.0; if (((F * F) <= 5e-301) || (~(((F * F) <= 2e-274)) && ((F * F) <= 2e-47))) tmp = (l / F) * (-pi / F); else tmp = pi * l; end tmp_2 = tmp; end
code[F_, l_] := If[Or[LessEqual[N[(F * F), $MachinePrecision], 5e-301], And[N[Not[LessEqual[N[(F * F), $MachinePrecision], 2e-274]], $MachinePrecision], LessEqual[N[(F * F), $MachinePrecision], 2e-47]]], N[(N[(l / F), $MachinePrecision] * N[((-Pi) / F), $MachinePrecision]), $MachinePrecision], N[(Pi * l), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \cdot F \leq 5 \cdot 10^{-301} \lor \neg \left(F \cdot F \leq 2 \cdot 10^{-274}\right) \land F \cdot F \leq 2 \cdot 10^{-47}:\\
\;\;\;\;\frac{\ell}{F} \cdot \frac{-\pi}{F}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell\\
\end{array}
\end{array}
if (*.f64 F F) < 5.00000000000000013e-301 or 1.99999999999999993e-274 < (*.f64 F F) < 1.9999999999999999e-47Initial program 54.8%
Taylor expanded in l around 0 48.1%
associate-/l*48.0%
unpow248.0%
Simplified48.0%
Taylor expanded in l around 0 48.1%
unpow248.1%
times-frac64.6%
Simplified64.6%
Taylor expanded in F around 0 48.1%
unpow248.1%
times-frac64.6%
neg-mul-164.6%
distribute-rgt-neg-in64.6%
distribute-neg-frac64.6%
Simplified64.6%
if 5.00000000000000013e-301 < (*.f64 F F) < 1.99999999999999993e-274 or 1.9999999999999999e-47 < (*.f64 F F) Initial program 95.8%
Taylor expanded in l around 0 88.7%
associate-/l*88.7%
unpow288.7%
Simplified88.7%
Taylor expanded in l around 0 88.7%
unpow288.7%
times-frac88.7%
Simplified88.7%
Taylor expanded in F around inf 94.1%
Final simplification82.3%
(FPCore (F l)
:precision binary64
(if (or (<= l -4.6e-84)
(not
(or (<= l -4.8e-200) (and (not (<= l 1.15e-192)) (<= l 9.5e-62)))))
(* PI l)
(/ (- l) (/ (* F F) PI))))
double code(double F, double l) {
double tmp;
if ((l <= -4.6e-84) || !((l <= -4.8e-200) || (!(l <= 1.15e-192) && (l <= 9.5e-62)))) {
tmp = ((double) M_PI) * l;
} else {
tmp = -l / ((F * F) / ((double) M_PI));
}
return tmp;
}
public static double code(double F, double l) {
double tmp;
if ((l <= -4.6e-84) || !((l <= -4.8e-200) || (!(l <= 1.15e-192) && (l <= 9.5e-62)))) {
tmp = Math.PI * l;
} else {
tmp = -l / ((F * F) / Math.PI);
}
return tmp;
}
def code(F, l): tmp = 0 if (l <= -4.6e-84) or not ((l <= -4.8e-200) or (not (l <= 1.15e-192) and (l <= 9.5e-62))): tmp = math.pi * l else: tmp = -l / ((F * F) / math.pi) return tmp
function code(F, l) tmp = 0.0 if ((l <= -4.6e-84) || !((l <= -4.8e-200) || (!(l <= 1.15e-192) && (l <= 9.5e-62)))) tmp = Float64(pi * l); else tmp = Float64(Float64(-l) / Float64(Float64(F * F) / pi)); end return tmp end
function tmp_2 = code(F, l) tmp = 0.0; if ((l <= -4.6e-84) || ~(((l <= -4.8e-200) || (~((l <= 1.15e-192)) && (l <= 9.5e-62))))) tmp = pi * l; else tmp = -l / ((F * F) / pi); end tmp_2 = tmp; end
code[F_, l_] := If[Or[LessEqual[l, -4.6e-84], N[Not[Or[LessEqual[l, -4.8e-200], And[N[Not[LessEqual[l, 1.15e-192]], $MachinePrecision], LessEqual[l, 9.5e-62]]]], $MachinePrecision]], N[(Pi * l), $MachinePrecision], N[((-l) / N[(N[(F * F), $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.6 \cdot 10^{-84} \lor \neg \left(\ell \leq -4.8 \cdot 10^{-200} \lor \neg \left(\ell \leq 1.15 \cdot 10^{-192}\right) \land \ell \leq 9.5 \cdot 10^{-62}\right):\\
\;\;\;\;\pi \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;\frac{-\ell}{\frac{F \cdot F}{\pi}}\\
\end{array}
\end{array}
if l < -4.59999999999999961e-84 or -4.80000000000000003e-200 < l < 1.15000000000000009e-192 or 9.49999999999999951e-62 < l Initial program 78.3%
Taylor expanded in l around 0 69.6%
associate-/l*69.6%
unpow269.6%
Simplified69.6%
Taylor expanded in l around 0 69.6%
unpow269.6%
times-frac74.2%
Simplified74.2%
Taylor expanded in F around inf 82.3%
if -4.59999999999999961e-84 < l < -4.80000000000000003e-200 or 1.15000000000000009e-192 < l < 9.49999999999999951e-62Initial program 84.6%
Taylor expanded in l around 0 84.6%
associate-/l*84.5%
unpow284.5%
Simplified84.5%
Taylor expanded in l around 0 84.6%
unpow284.6%
times-frac99.6%
Simplified99.6%
Taylor expanded in F around 0 67.1%
mul-1-neg67.1%
associate-/l*67.0%
unpow267.0%
Simplified67.0%
Final simplification79.4%
(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 79.5%
Taylor expanded in l around 0 72.5%
associate-/l*72.5%
unpow272.5%
Simplified72.5%
Taylor expanded in l around 0 72.5%
unpow272.5%
times-frac79.1%
Simplified79.1%
Taylor expanded in F around inf 70.3%
Final simplification70.3%
herbie shell --seed 2023193
(FPCore (F l)
:name "VandenBroeck and Keller, Equation (6)"
:precision binary64
(- (* PI l) (* (/ 1.0 (* F F)) (tan (* PI l)))))