
(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]
\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right)
Herbie found 9 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]
\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right)
(FPCore (F l)
:precision binary64
(let* ((t_0 (* (fabs l) PI)))
(*
(copysign 1.0 l)
(if (<= (fabs l) 1.85e+15)
(- (* PI (fabs l)) (/ 1.0 (/ F (/ (tan t_0) F))))
t_0))))double code(double F, double l) {
double t_0 = fabs(l) * ((double) M_PI);
double tmp;
if (fabs(l) <= 1.85e+15) {
tmp = (((double) M_PI) * fabs(l)) - (1.0 / (F / (tan(t_0) / F)));
} else {
tmp = t_0;
}
return copysign(1.0, l) * tmp;
}
public static double code(double F, double l) {
double t_0 = Math.abs(l) * Math.PI;
double tmp;
if (Math.abs(l) <= 1.85e+15) {
tmp = (Math.PI * Math.abs(l)) - (1.0 / (F / (Math.tan(t_0) / F)));
} else {
tmp = t_0;
}
return Math.copySign(1.0, l) * tmp;
}
def code(F, l): t_0 = math.fabs(l) * math.pi tmp = 0 if math.fabs(l) <= 1.85e+15: tmp = (math.pi * math.fabs(l)) - (1.0 / (F / (math.tan(t_0) / F))) else: tmp = t_0 return math.copysign(1.0, l) * tmp
function code(F, l) t_0 = Float64(abs(l) * pi) tmp = 0.0 if (abs(l) <= 1.85e+15) tmp = Float64(Float64(pi * abs(l)) - Float64(1.0 / Float64(F / Float64(tan(t_0) / F)))); else tmp = t_0; end return Float64(copysign(1.0, l) * tmp) end
function tmp_2 = code(F, l) t_0 = abs(l) * pi; tmp = 0.0; if (abs(l) <= 1.85e+15) tmp = (pi * abs(l)) - (1.0 / (F / (tan(t_0) / F))); else tmp = t_0; end tmp_2 = (sign(l) * abs(1.0)) * tmp; end
code[F_, l_] := Block[{t$95$0 = N[(N[Abs[l], $MachinePrecision] * Pi), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[l]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[l], $MachinePrecision], 1.85e+15], N[(N[(Pi * N[Abs[l], $MachinePrecision]), $MachinePrecision] - N[(1.0 / N[(F / N[(N[Tan[t$95$0], $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]), $MachinePrecision]]
\begin{array}{l}
t_0 := \left|\ell\right| \cdot \pi\\
\mathsf{copysign}\left(1, \ell\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|\ell\right| \leq 1.85 \cdot 10^{+15}:\\
\;\;\;\;\pi \cdot \left|\ell\right| - \frac{1}{\frac{F}{\frac{\tan t\_0}{F}}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < 1.85e15Initial program 76.1%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
mult-flip-revN/A
lift-*.f64N/A
associate-/r*N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lower-/.f6481.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6481.8%
Applied rewrites81.8%
if 1.85e15 < l Initial program 76.1%
Taylor expanded in F around inf
lower-*.f64N/A
lower-PI.f6473.6%
Applied rewrites73.6%
(FPCore (F l)
:precision binary64
(let* ((t_0 (* (fabs l) PI)))
(*
(copysign 1.0 l)
(if (<= (fabs l) 1.85e+15)
(fma (/ (tan t_0) F) (/ -1.0 F) t_0)
t_0))))double code(double F, double l) {
double t_0 = fabs(l) * ((double) M_PI);
double tmp;
if (fabs(l) <= 1.85e+15) {
tmp = fma((tan(t_0) / F), (-1.0 / F), t_0);
} else {
tmp = t_0;
}
return copysign(1.0, l) * tmp;
}
function code(F, l) t_0 = Float64(abs(l) * pi) tmp = 0.0 if (abs(l) <= 1.85e+15) tmp = fma(Float64(tan(t_0) / F), Float64(-1.0 / F), t_0); else tmp = t_0; end return Float64(copysign(1.0, l) * tmp) end
code[F_, l_] := Block[{t$95$0 = N[(N[Abs[l], $MachinePrecision] * Pi), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[l]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[l], $MachinePrecision], 1.85e+15], N[(N[(N[Tan[t$95$0], $MachinePrecision] / F), $MachinePrecision] * N[(-1.0 / F), $MachinePrecision] + t$95$0), $MachinePrecision], t$95$0]), $MachinePrecision]]
\begin{array}{l}
t_0 := \left|\ell\right| \cdot \pi\\
\mathsf{copysign}\left(1, \ell\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|\ell\right| \leq 1.85 \cdot 10^{+15}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\tan t\_0}{F}, \frac{-1}{F}, t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < 1.85e15Initial program 76.1%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
lift-/.f64N/A
distribute-neg-frac2N/A
associate-*l/N/A
*-commutativeN/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
times-fracN/A
lower-fma.f64N/A
Applied rewrites81.8%
if 1.85e15 < l Initial program 76.1%
Taylor expanded in F around inf
lower-*.f64N/A
lower-PI.f6473.6%
Applied rewrites73.6%
(FPCore (F l)
:precision binary64
(let* ((t_0 (* (fabs l) PI)))
(*
(copysign 1.0 l)
(if (<= (fabs l) 1.85e+15)
(- (* PI (fabs l)) (/ (/ (tan t_0) F) F))
t_0))))double code(double F, double l) {
double t_0 = fabs(l) * ((double) M_PI);
double tmp;
if (fabs(l) <= 1.85e+15) {
tmp = (((double) M_PI) * fabs(l)) - ((tan(t_0) / F) / F);
} else {
tmp = t_0;
}
return copysign(1.0, l) * tmp;
}
public static double code(double F, double l) {
double t_0 = Math.abs(l) * Math.PI;
double tmp;
if (Math.abs(l) <= 1.85e+15) {
tmp = (Math.PI * Math.abs(l)) - ((Math.tan(t_0) / F) / F);
} else {
tmp = t_0;
}
return Math.copySign(1.0, l) * tmp;
}
def code(F, l): t_0 = math.fabs(l) * math.pi tmp = 0 if math.fabs(l) <= 1.85e+15: tmp = (math.pi * math.fabs(l)) - ((math.tan(t_0) / F) / F) else: tmp = t_0 return math.copysign(1.0, l) * tmp
function code(F, l) t_0 = Float64(abs(l) * pi) tmp = 0.0 if (abs(l) <= 1.85e+15) tmp = Float64(Float64(pi * abs(l)) - Float64(Float64(tan(t_0) / F) / F)); else tmp = t_0; end return Float64(copysign(1.0, l) * tmp) end
function tmp_2 = code(F, l) t_0 = abs(l) * pi; tmp = 0.0; if (abs(l) <= 1.85e+15) tmp = (pi * abs(l)) - ((tan(t_0) / F) / F); else tmp = t_0; end tmp_2 = (sign(l) * abs(1.0)) * tmp; end
code[F_, l_] := Block[{t$95$0 = N[(N[Abs[l], $MachinePrecision] * Pi), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[l]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[l], $MachinePrecision], 1.85e+15], N[(N[(Pi * N[Abs[l], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Tan[t$95$0], $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision], t$95$0]), $MachinePrecision]]
\begin{array}{l}
t_0 := \left|\ell\right| \cdot \pi\\
\mathsf{copysign}\left(1, \ell\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|\ell\right| \leq 1.85 \cdot 10^{+15}:\\
\;\;\;\;\pi \cdot \left|\ell\right| - \frac{\frac{\tan t\_0}{F}}{F}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < 1.85e15Initial program 76.1%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
mult-flip-revN/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6481.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6481.8%
Applied rewrites81.8%
if 1.85e15 < l Initial program 76.1%
Taylor expanded in F around inf
lower-*.f64N/A
lower-PI.f6473.6%
Applied rewrites73.6%
(FPCore (F l)
:precision binary64
(let* ((t_0 (* (fabs l) PI)))
(*
(copysign 1.0 l)
(if (<= (fabs l) 4500000000000.0)
(fma (/ -1.0 F) (/ t_0 F) (* PI (fabs l)))
t_0))))double code(double F, double l) {
double t_0 = fabs(l) * ((double) M_PI);
double tmp;
if (fabs(l) <= 4500000000000.0) {
tmp = fma((-1.0 / F), (t_0 / F), (((double) M_PI) * fabs(l)));
} else {
tmp = t_0;
}
return copysign(1.0, l) * tmp;
}
function code(F, l) t_0 = Float64(abs(l) * pi) tmp = 0.0 if (abs(l) <= 4500000000000.0) tmp = fma(Float64(-1.0 / F), Float64(t_0 / F), Float64(pi * abs(l))); else tmp = t_0; end return Float64(copysign(1.0, l) * tmp) end
code[F_, l_] := Block[{t$95$0 = N[(N[Abs[l], $MachinePrecision] * Pi), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[l]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[l], $MachinePrecision], 4500000000000.0], N[(N[(-1.0 / F), $MachinePrecision] * N[(t$95$0 / F), $MachinePrecision] + N[(Pi * N[Abs[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]), $MachinePrecision]]
\begin{array}{l}
t_0 := \left|\ell\right| \cdot \pi\\
\mathsf{copysign}\left(1, \ell\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|\ell\right| \leq 4500000000000:\\
\;\;\;\;\mathsf{fma}\left(\frac{-1}{F}, \frac{t\_0}{F}, \pi \cdot \left|\ell\right|\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < 4.5e12Initial program 76.1%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
mult-flip-revN/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6481.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6481.8%
Applied rewrites81.8%
Applied rewrites81.8%
Taylor expanded in l around 0
lower-/.f64N/A
lower-*.f64N/A
lower-PI.f6474.1%
Applied rewrites74.1%
if 4.5e12 < l Initial program 76.1%
Taylor expanded in F around inf
lower-*.f64N/A
lower-PI.f6473.6%
Applied rewrites73.6%
(FPCore (F l)
:precision binary64
(let* ((t_0 (* (fabs l) PI)))
(*
(copysign 1.0 l)
(if (<= (fabs l) 4500000000000.0)
(- (* PI (fabs l)) (/ (/ t_0 F) F))
t_0))))double code(double F, double l) {
double t_0 = fabs(l) * ((double) M_PI);
double tmp;
if (fabs(l) <= 4500000000000.0) {
tmp = (((double) M_PI) * fabs(l)) - ((t_0 / F) / F);
} else {
tmp = t_0;
}
return copysign(1.0, l) * tmp;
}
public static double code(double F, double l) {
double t_0 = Math.abs(l) * Math.PI;
double tmp;
if (Math.abs(l) <= 4500000000000.0) {
tmp = (Math.PI * Math.abs(l)) - ((t_0 / F) / F);
} else {
tmp = t_0;
}
return Math.copySign(1.0, l) * tmp;
}
def code(F, l): t_0 = math.fabs(l) * math.pi tmp = 0 if math.fabs(l) <= 4500000000000.0: tmp = (math.pi * math.fabs(l)) - ((t_0 / F) / F) else: tmp = t_0 return math.copysign(1.0, l) * tmp
function code(F, l) t_0 = Float64(abs(l) * pi) tmp = 0.0 if (abs(l) <= 4500000000000.0) tmp = Float64(Float64(pi * abs(l)) - Float64(Float64(t_0 / F) / F)); else tmp = t_0; end return Float64(copysign(1.0, l) * tmp) end
function tmp_2 = code(F, l) t_0 = abs(l) * pi; tmp = 0.0; if (abs(l) <= 4500000000000.0) tmp = (pi * abs(l)) - ((t_0 / F) / F); else tmp = t_0; end tmp_2 = (sign(l) * abs(1.0)) * tmp; end
code[F_, l_] := Block[{t$95$0 = N[(N[Abs[l], $MachinePrecision] * Pi), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[l]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[l], $MachinePrecision], 4500000000000.0], N[(N[(Pi * N[Abs[l], $MachinePrecision]), $MachinePrecision] - N[(N[(t$95$0 / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision], t$95$0]), $MachinePrecision]]
\begin{array}{l}
t_0 := \left|\ell\right| \cdot \pi\\
\mathsf{copysign}\left(1, \ell\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|\ell\right| \leq 4500000000000:\\
\;\;\;\;\pi \cdot \left|\ell\right| - \frac{\frac{t\_0}{F}}{F}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < 4.5e12Initial program 76.1%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
mult-flip-revN/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6481.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6481.8%
Applied rewrites81.8%
Taylor expanded in l around 0
lower-/.f64N/A
lower-*.f64N/A
lower-PI.f6474.1%
Applied rewrites74.1%
if 4.5e12 < l Initial program 76.1%
Taylor expanded in F around inf
lower-*.f64N/A
lower-PI.f6473.6%
Applied rewrites73.6%
(FPCore (F l) :precision binary64 (* (copysign 1.0 l) (if (<= (fabs l) 4500000000000.0) (* (- PI (/ PI (* F F))) (fabs l)) (* (fabs l) PI))))
double code(double F, double l) {
double tmp;
if (fabs(l) <= 4500000000000.0) {
tmp = (((double) M_PI) - (((double) M_PI) / (F * F))) * fabs(l);
} else {
tmp = fabs(l) * ((double) M_PI);
}
return copysign(1.0, l) * tmp;
}
public static double code(double F, double l) {
double tmp;
if (Math.abs(l) <= 4500000000000.0) {
tmp = (Math.PI - (Math.PI / (F * F))) * Math.abs(l);
} else {
tmp = Math.abs(l) * Math.PI;
}
return Math.copySign(1.0, l) * tmp;
}
def code(F, l): tmp = 0 if math.fabs(l) <= 4500000000000.0: tmp = (math.pi - (math.pi / (F * F))) * math.fabs(l) else: tmp = math.fabs(l) * math.pi return math.copysign(1.0, l) * tmp
function code(F, l) tmp = 0.0 if (abs(l) <= 4500000000000.0) tmp = Float64(Float64(pi - Float64(pi / Float64(F * F))) * abs(l)); else tmp = Float64(abs(l) * pi); end return Float64(copysign(1.0, l) * tmp) end
function tmp_2 = code(F, l) tmp = 0.0; if (abs(l) <= 4500000000000.0) tmp = (pi - (pi / (F * F))) * abs(l); else tmp = abs(l) * pi; end tmp_2 = (sign(l) * abs(1.0)) * tmp; end
code[F_, l_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[l]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[l], $MachinePrecision], 4500000000000.0], N[(N[(Pi - N[(Pi / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[l], $MachinePrecision]), $MachinePrecision], N[(N[Abs[l], $MachinePrecision] * Pi), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, \ell\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|\ell\right| \leq 4500000000000:\\
\;\;\;\;\left(\pi - \frac{\pi}{F \cdot F}\right) \cdot \left|\ell\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\ell\right| \cdot \pi\\
\end{array}
if l < 4.5e12Initial program 76.1%
Taylor expanded in l around 0
lower-*.f64N/A
lower--.f64N/A
lower-PI.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-pow.f6468.5%
Applied rewrites68.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6468.5%
lift-pow.f64N/A
pow2N/A
lift-*.f6468.5%
Applied rewrites68.5%
if 4.5e12 < l Initial program 76.1%
Taylor expanded in F around inf
lower-*.f64N/A
lower-PI.f6473.6%
Applied rewrites73.6%
(FPCore (F l)
:precision binary64
(let* ((t_0 (* PI (fabs l))))
(*
(copysign 1.0 l)
(if (<= (- t_0 (* (/ 1.0 (* F F)) (tan t_0))) -2e-226)
(* (/ (- PI) F) (/ (fabs l) F))
(* (fabs l) PI)))))double code(double F, double l) {
double t_0 = ((double) M_PI) * fabs(l);
double tmp;
if ((t_0 - ((1.0 / (F * F)) * tan(t_0))) <= -2e-226) {
tmp = (-((double) M_PI) / F) * (fabs(l) / F);
} else {
tmp = fabs(l) * ((double) M_PI);
}
return copysign(1.0, l) * tmp;
}
public static double code(double F, double l) {
double t_0 = Math.PI * Math.abs(l);
double tmp;
if ((t_0 - ((1.0 / (F * F)) * Math.tan(t_0))) <= -2e-226) {
tmp = (-Math.PI / F) * (Math.abs(l) / F);
} else {
tmp = Math.abs(l) * Math.PI;
}
return Math.copySign(1.0, l) * tmp;
}
def code(F, l): t_0 = math.pi * math.fabs(l) tmp = 0 if (t_0 - ((1.0 / (F * F)) * math.tan(t_0))) <= -2e-226: tmp = (-math.pi / F) * (math.fabs(l) / F) else: tmp = math.fabs(l) * math.pi return math.copysign(1.0, l) * tmp
function code(F, l) t_0 = Float64(pi * abs(l)) tmp = 0.0 if (Float64(t_0 - Float64(Float64(1.0 / Float64(F * F)) * tan(t_0))) <= -2e-226) tmp = Float64(Float64(Float64(-pi) / F) * Float64(abs(l) / F)); else tmp = Float64(abs(l) * pi); end return Float64(copysign(1.0, l) * tmp) end
function tmp_2 = code(F, l) t_0 = pi * abs(l); tmp = 0.0; if ((t_0 - ((1.0 / (F * F)) * tan(t_0))) <= -2e-226) tmp = (-pi / F) * (abs(l) / F); else tmp = abs(l) * pi; end tmp_2 = (sign(l) * abs(1.0)) * tmp; end
code[F_, l_] := Block[{t$95$0 = N[(Pi * N[Abs[l], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[l]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(t$95$0 - N[(N[(1.0 / N[(F * F), $MachinePrecision]), $MachinePrecision] * N[Tan[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2e-226], N[(N[((-Pi) / F), $MachinePrecision] * N[(N[Abs[l], $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision], N[(N[Abs[l], $MachinePrecision] * Pi), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
t_0 := \pi \cdot \left|\ell\right|\\
\mathsf{copysign}\left(1, \ell\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_0 - \frac{1}{F \cdot F} \cdot \tan t\_0 \leq -2 \cdot 10^{-226}:\\
\;\;\;\;\frac{-\pi}{F} \cdot \frac{\left|\ell\right|}{F}\\
\mathbf{else}:\\
\;\;\;\;\left|\ell\right| \cdot \pi\\
\end{array}
\end{array}
if (-.f64 (*.f64 (PI.f64) l) (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 F F)) (tan.f64 (*.f64 (PI.f64) l)))) < -1.9999999999999998e-226Initial program 76.1%
Taylor expanded in l around 0
lower-*.f64N/A
lower--.f64N/A
lower-PI.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-pow.f6468.5%
Applied rewrites68.5%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
sub-to-fractionN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6438.2%
Applied rewrites38.2%
Taylor expanded in F around 0
lower-*.f64N/A
lower-PI.f6421.1%
Applied rewrites21.1%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-neg.f64N/A
Applied rewrites26.4%
if -1.9999999999999998e-226 < (-.f64 (*.f64 (PI.f64) l) (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 F F)) (tan.f64 (*.f64 (PI.f64) l)))) Initial program 76.1%
Taylor expanded in F around inf
lower-*.f64N/A
lower-PI.f6473.6%
Applied rewrites73.6%
(FPCore (F l)
:precision binary64
(let* ((t_0 (* PI (fabs l))))
(*
(copysign 1.0 l)
(if (<= (- t_0 (* (/ 1.0 (* F F)) (tan t_0))) -2e-226)
(/ (* -3.141592653589793 (fabs l)) (* F F))
(* (fabs l) PI)))))double code(double F, double l) {
double t_0 = ((double) M_PI) * fabs(l);
double tmp;
if ((t_0 - ((1.0 / (F * F)) * tan(t_0))) <= -2e-226) {
tmp = (-3.141592653589793 * fabs(l)) / (F * F);
} else {
tmp = fabs(l) * ((double) M_PI);
}
return copysign(1.0, l) * tmp;
}
public static double code(double F, double l) {
double t_0 = Math.PI * Math.abs(l);
double tmp;
if ((t_0 - ((1.0 / (F * F)) * Math.tan(t_0))) <= -2e-226) {
tmp = (-3.141592653589793 * Math.abs(l)) / (F * F);
} else {
tmp = Math.abs(l) * Math.PI;
}
return Math.copySign(1.0, l) * tmp;
}
def code(F, l): t_0 = math.pi * math.fabs(l) tmp = 0 if (t_0 - ((1.0 / (F * F)) * math.tan(t_0))) <= -2e-226: tmp = (-3.141592653589793 * math.fabs(l)) / (F * F) else: tmp = math.fabs(l) * math.pi return math.copysign(1.0, l) * tmp
function code(F, l) t_0 = Float64(pi * abs(l)) tmp = 0.0 if (Float64(t_0 - Float64(Float64(1.0 / Float64(F * F)) * tan(t_0))) <= -2e-226) tmp = Float64(Float64(-3.141592653589793 * abs(l)) / Float64(F * F)); else tmp = Float64(abs(l) * pi); end return Float64(copysign(1.0, l) * tmp) end
function tmp_2 = code(F, l) t_0 = pi * abs(l); tmp = 0.0; if ((t_0 - ((1.0 / (F * F)) * tan(t_0))) <= -2e-226) tmp = (-3.141592653589793 * abs(l)) / (F * F); else tmp = abs(l) * pi; end tmp_2 = (sign(l) * abs(1.0)) * tmp; end
code[F_, l_] := Block[{t$95$0 = N[(Pi * N[Abs[l], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[l]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(t$95$0 - N[(N[(1.0 / N[(F * F), $MachinePrecision]), $MachinePrecision] * N[Tan[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2e-226], N[(N[(-3.141592653589793 * N[Abs[l], $MachinePrecision]), $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision], N[(N[Abs[l], $MachinePrecision] * Pi), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
t_0 := \pi \cdot \left|\ell\right|\\
\mathsf{copysign}\left(1, \ell\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_0 - \frac{1}{F \cdot F} \cdot \tan t\_0 \leq -2 \cdot 10^{-226}:\\
\;\;\;\;\frac{-3.141592653589793 \cdot \left|\ell\right|}{F \cdot F}\\
\mathbf{else}:\\
\;\;\;\;\left|\ell\right| \cdot \pi\\
\end{array}
\end{array}
if (-.f64 (*.f64 (PI.f64) l) (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 F F)) (tan.f64 (*.f64 (PI.f64) l)))) < -1.9999999999999998e-226Initial program 76.1%
Taylor expanded in l around 0
lower-*.f64N/A
lower--.f64N/A
lower-PI.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-pow.f6468.5%
Applied rewrites68.5%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
sub-to-fractionN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6438.2%
Applied rewrites38.2%
Taylor expanded in F around 0
lower-*.f64N/A
lower-PI.f6421.1%
Applied rewrites21.1%
Evaluated real constant21.1%
if -1.9999999999999998e-226 < (-.f64 (*.f64 (PI.f64) l) (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 F F)) (tan.f64 (*.f64 (PI.f64) l)))) Initial program 76.1%
Taylor expanded in F around inf
lower-*.f64N/A
lower-PI.f6473.6%
Applied rewrites73.6%
(FPCore (F l) :precision binary64 (* l PI))
double code(double F, double l) {
return l * ((double) M_PI);
}
public static double code(double F, double l) {
return l * Math.PI;
}
def code(F, l): return l * math.pi
function code(F, l) return Float64(l * pi) end
function tmp = code(F, l) tmp = l * pi; end
code[F_, l_] := N[(l * Pi), $MachinePrecision]
\ell \cdot \pi
Initial program 76.1%
Taylor expanded in F around inf
lower-*.f64N/A
lower-PI.f6473.6%
Applied rewrites73.6%
herbie shell --seed 2025213
(FPCore (F l)
:name "VandenBroeck and Keller, Equation (6)"
:precision binary64
(- (* PI l) (* (/ 1.0 (* F F)) (tan (* PI l)))))