
(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}
l_m = (fabs.f64 l)
l_s = (copysign.f64 1 l)
(FPCore (l_s F l_m)
:precision binary64
(*
l_s
(-
(* PI l_m)
(/
(/ 1.0 F)
(fma
-1.0
(/
F
(log (exp (/ (pow PI 2.0) (* l_m (* (pow PI 3.0) 0.3333333333333333))))))
(/ F (* PI l_m)))))))l_m = fabs(l);
l_s = copysign(1.0, l);
double code(double l_s, double F, double l_m) {
return l_s * ((((double) M_PI) * l_m) - ((1.0 / F) / fma(-1.0, (F / log(exp((pow(((double) M_PI), 2.0) / (l_m * (pow(((double) M_PI), 3.0) * 0.3333333333333333)))))), (F / (((double) M_PI) * l_m)))));
}
l_m = abs(l) l_s = copysign(1.0, l) function code(l_s, F, l_m) return Float64(l_s * Float64(Float64(pi * l_m) - Float64(Float64(1.0 / F) / fma(-1.0, Float64(F / log(exp(Float64((pi ^ 2.0) / Float64(l_m * Float64((pi ^ 3.0) * 0.3333333333333333)))))), Float64(F / Float64(pi * l_m)))))) end
l_m = N[Abs[l], $MachinePrecision]
l_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[l]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[l$95$s_, F_, l$95$m_] := N[(l$95$s * N[(N[(Pi * l$95$m), $MachinePrecision] - N[(N[(1.0 / F), $MachinePrecision] / N[(-1.0 * N[(F / N[Log[N[Exp[N[(N[Power[Pi, 2.0], $MachinePrecision] / N[(l$95$m * N[(N[Power[Pi, 3.0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(F / N[(Pi * l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
l_s = \mathsf{copysign}\left(1, \ell\right)
\\
l_s \cdot \left(\pi \cdot l_m - \frac{\frac{1}{F}}{\mathsf{fma}\left(-1, \frac{F}{\log \left(e^{\frac{{\pi}^{2}}{l_m \cdot \left({\pi}^{3} \cdot 0.3333333333333333\right)}}\right)}, \frac{F}{\pi \cdot l_m}\right)}\right)
\end{array}
Initial program 76.6%
associate-/r/76.7%
associate-/l*81.0%
clear-num81.0%
add-sqr-sqrt38.9%
sqrt-prod66.1%
sqr-neg66.1%
sqrt-unprod28.6%
add-sqr-sqrt55.0%
div-inv55.0%
clear-num55.0%
associate-*l/55.0%
*-un-lft-identity55.0%
add-sqr-sqrt28.6%
sqrt-unprod66.1%
sqr-neg66.1%
sqrt-prod38.9%
add-sqr-sqrt81.0%
Applied egg-rr81.0%
Taylor expanded in l around 0 87.3%
fma-def87.3%
associate-/l*87.3%
distribute-rgt-out--87.3%
metadata-eval87.3%
Simplified87.3%
add-log-exp98.1%
Applied egg-rr98.1%
Final simplification98.1%
l_m = (fabs.f64 l) l_s = (copysign.f64 1 l) (FPCore (l_s F l_m) :precision binary64 (* l_s (+ (* PI l_m) (/ (/ -1.0 F) (fma -1.0 (/ F (/ 3.0 (* PI l_m))) (/ F (* PI l_m)))))))
l_m = fabs(l);
l_s = copysign(1.0, l);
double code(double l_s, double F, double l_m) {
return l_s * ((((double) M_PI) * l_m) + ((-1.0 / F) / fma(-1.0, (F / (3.0 / (((double) M_PI) * l_m))), (F / (((double) M_PI) * l_m)))));
}
l_m = abs(l) l_s = copysign(1.0, l) function code(l_s, F, l_m) return Float64(l_s * Float64(Float64(pi * l_m) + Float64(Float64(-1.0 / F) / fma(-1.0, Float64(F / Float64(3.0 / Float64(pi * l_m))), Float64(F / Float64(pi * l_m)))))) end
l_m = N[Abs[l], $MachinePrecision]
l_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[l]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[l$95$s_, F_, l$95$m_] := N[(l$95$s * N[(N[(Pi * l$95$m), $MachinePrecision] + N[(N[(-1.0 / F), $MachinePrecision] / N[(-1.0 * N[(F / N[(3.0 / N[(Pi * l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(F / N[(Pi * l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
l_s = \mathsf{copysign}\left(1, \ell\right)
\\
l_s \cdot \left(\pi \cdot l_m + \frac{\frac{-1}{F}}{\mathsf{fma}\left(-1, \frac{F}{\frac{3}{\pi \cdot l_m}}, \frac{F}{\pi \cdot l_m}\right)}\right)
\end{array}
Initial program 76.6%
associate-/r/76.7%
associate-/l*81.0%
clear-num81.0%
add-sqr-sqrt38.9%
sqrt-prod66.1%
sqr-neg66.1%
sqrt-unprod28.6%
add-sqr-sqrt55.0%
div-inv55.0%
clear-num55.0%
associate-*l/55.0%
*-un-lft-identity55.0%
add-sqr-sqrt28.6%
sqrt-unprod66.1%
sqr-neg66.1%
sqrt-prod38.9%
add-sqr-sqrt81.0%
Applied egg-rr81.0%
Taylor expanded in l around 0 87.3%
fma-def87.3%
associate-/l*87.3%
distribute-rgt-out--87.3%
metadata-eval87.3%
Simplified87.3%
Taylor expanded in l around 0 87.3%
Final simplification87.3%
l_m = (fabs.f64 l)
l_s = (copysign.f64 1 l)
(FPCore (l_s F l_m)
:precision binary64
(*
l_s
(if (<= (* PI l_m) 5e-20)
(- (* PI l_m) (/ (* PI (/ l_m F)) F))
(- (* PI l_m) (/ (tan (* PI l_m)) (* F F))))))l_m = fabs(l);
l_s = copysign(1.0, l);
double code(double l_s, double F, double l_m) {
double tmp;
if ((((double) M_PI) * l_m) <= 5e-20) {
tmp = (((double) M_PI) * l_m) - ((((double) M_PI) * (l_m / F)) / F);
} else {
tmp = (((double) M_PI) * l_m) - (tan((((double) M_PI) * l_m)) / (F * F));
}
return l_s * tmp;
}
l_m = Math.abs(l);
l_s = Math.copySign(1.0, l);
public static double code(double l_s, double F, double l_m) {
double tmp;
if ((Math.PI * l_m) <= 5e-20) {
tmp = (Math.PI * l_m) - ((Math.PI * (l_m / F)) / F);
} else {
tmp = (Math.PI * l_m) - (Math.tan((Math.PI * l_m)) / (F * F));
}
return l_s * tmp;
}
l_m = math.fabs(l) l_s = math.copysign(1.0, l) def code(l_s, F, l_m): tmp = 0 if (math.pi * l_m) <= 5e-20: tmp = (math.pi * l_m) - ((math.pi * (l_m / F)) / F) else: tmp = (math.pi * l_m) - (math.tan((math.pi * l_m)) / (F * F)) return l_s * tmp
l_m = abs(l) l_s = copysign(1.0, l) function code(l_s, F, l_m) tmp = 0.0 if (Float64(pi * l_m) <= 5e-20) tmp = Float64(Float64(pi * l_m) - Float64(Float64(pi * Float64(l_m / F)) / F)); else tmp = Float64(Float64(pi * l_m) - Float64(tan(Float64(pi * l_m)) / Float64(F * F))); end return Float64(l_s * tmp) end
l_m = abs(l); l_s = sign(l) * abs(1.0); function tmp_2 = code(l_s, F, l_m) tmp = 0.0; if ((pi * l_m) <= 5e-20) tmp = (pi * l_m) - ((pi * (l_m / F)) / F); else tmp = (pi * l_m) - (tan((pi * l_m)) / (F * F)); end tmp_2 = l_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
l_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[l]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[l$95$s_, F_, l$95$m_] := N[(l$95$s * If[LessEqual[N[(Pi * l$95$m), $MachinePrecision], 5e-20], N[(N[(Pi * l$95$m), $MachinePrecision] - N[(N[(Pi * N[(l$95$m / F), $MachinePrecision]), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * l$95$m), $MachinePrecision] - N[(N[Tan[N[(Pi * l$95$m), $MachinePrecision]], $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
l_s = \mathsf{copysign}\left(1, \ell\right)
\\
l_s \cdot \begin{array}{l}
\mathbf{if}\;\pi \cdot l_m \leq 5 \cdot 10^{-20}:\\
\;\;\;\;\pi \cdot l_m - \frac{\pi \cdot \frac{l_m}{F}}{F}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot l_m - \frac{\tan \left(\pi \cdot l_m\right)}{F \cdot F}\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 4.9999999999999999e-20Initial program 77.9%
sqr-neg77.9%
associate-*l/77.9%
*-lft-identity77.9%
sqr-neg77.9%
Simplified77.9%
Taylor expanded in l around 0 73.7%
*-commutative73.7%
times-frac79.7%
Applied egg-rr79.7%
associate-*l/79.7%
Applied egg-rr79.7%
if 4.9999999999999999e-20 < (*.f64 (PI.f64) l) Initial program 73.4%
sqr-neg73.4%
associate-*l/73.4%
*-lft-identity73.4%
sqr-neg73.4%
Simplified73.4%
Final simplification78.0%
l_m = (fabs.f64 l) l_s = (copysign.f64 1 l) (FPCore (l_s F l_m) :precision binary64 (* l_s (+ (* PI l_m) (/ (/ -1.0 F) (/ F (tan (* PI l_m)))))))
l_m = fabs(l);
l_s = copysign(1.0, l);
double code(double l_s, double F, double l_m) {
return l_s * ((((double) M_PI) * l_m) + ((-1.0 / F) / (F / tan((((double) M_PI) * l_m)))));
}
l_m = Math.abs(l);
l_s = Math.copySign(1.0, l);
public static double code(double l_s, double F, double l_m) {
return l_s * ((Math.PI * l_m) + ((-1.0 / F) / (F / Math.tan((Math.PI * l_m)))));
}
l_m = math.fabs(l) l_s = math.copysign(1.0, l) def code(l_s, F, l_m): return l_s * ((math.pi * l_m) + ((-1.0 / F) / (F / math.tan((math.pi * l_m)))))
l_m = abs(l) l_s = copysign(1.0, l) function code(l_s, F, l_m) return Float64(l_s * Float64(Float64(pi * l_m) + Float64(Float64(-1.0 / F) / Float64(F / tan(Float64(pi * l_m)))))) end
l_m = abs(l); l_s = sign(l) * abs(1.0); function tmp = code(l_s, F, l_m) tmp = l_s * ((pi * l_m) + ((-1.0 / F) / (F / tan((pi * l_m))))); end
l_m = N[Abs[l], $MachinePrecision]
l_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[l]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[l$95$s_, F_, l$95$m_] := N[(l$95$s * N[(N[(Pi * l$95$m), $MachinePrecision] + N[(N[(-1.0 / F), $MachinePrecision] / N[(F / N[Tan[N[(Pi * l$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
l_s = \mathsf{copysign}\left(1, \ell\right)
\\
l_s \cdot \left(\pi \cdot l_m + \frac{\frac{-1}{F}}{\frac{F}{\tan \left(\pi \cdot l_m\right)}}\right)
\end{array}
Initial program 76.6%
associate-/r/76.7%
associate-/l*81.0%
clear-num81.0%
add-sqr-sqrt38.9%
sqrt-prod66.1%
sqr-neg66.1%
sqrt-unprod28.6%
add-sqr-sqrt55.0%
div-inv55.0%
clear-num55.0%
associate-*l/55.0%
*-un-lft-identity55.0%
add-sqr-sqrt28.6%
sqrt-unprod66.1%
sqr-neg66.1%
sqrt-prod38.9%
add-sqr-sqrt81.0%
Applied egg-rr81.0%
Final simplification81.0%
l_m = (fabs.f64 l) l_s = (copysign.f64 1 l) (FPCore (l_s F l_m) :precision binary64 (* l_s (- (* PI l_m) (/ (/ (tan (* PI l_m)) F) F))))
l_m = fabs(l);
l_s = copysign(1.0, l);
double code(double l_s, double F, double l_m) {
return l_s * ((((double) M_PI) * l_m) - ((tan((((double) M_PI) * l_m)) / F) / F));
}
l_m = Math.abs(l);
l_s = Math.copySign(1.0, l);
public static double code(double l_s, double F, double l_m) {
return l_s * ((Math.PI * l_m) - ((Math.tan((Math.PI * l_m)) / F) / F));
}
l_m = math.fabs(l) l_s = math.copysign(1.0, l) def code(l_s, F, l_m): return l_s * ((math.pi * l_m) - ((math.tan((math.pi * l_m)) / F) / F))
l_m = abs(l) l_s = copysign(1.0, l) function code(l_s, F, l_m) return Float64(l_s * Float64(Float64(pi * l_m) - Float64(Float64(tan(Float64(pi * l_m)) / F) / F))) end
l_m = abs(l); l_s = sign(l) * abs(1.0); function tmp = code(l_s, F, l_m) tmp = l_s * ((pi * l_m) - ((tan((pi * l_m)) / F) / F)); end
l_m = N[Abs[l], $MachinePrecision]
l_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[l]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[l$95$s_, F_, l$95$m_] := N[(l$95$s * N[(N[(Pi * l$95$m), $MachinePrecision] - N[(N[(N[Tan[N[(Pi * l$95$m), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
l_s = \mathsf{copysign}\left(1, \ell\right)
\\
l_s \cdot \left(\pi \cdot l_m - \frac{\frac{\tan \left(\pi \cdot l_m\right)}{F}}{F}\right)
\end{array}
Initial program 76.6%
associate-*l/76.7%
*-un-lft-identity76.7%
associate-/r*81.0%
Applied egg-rr81.0%
Final simplification81.0%
l_m = (fabs.f64 l)
l_s = (copysign.f64 1 l)
(FPCore (l_s F l_m)
:precision binary64
(*
l_s
(if (<= (* PI l_m) 50000000000000.0)
(- (* PI l_m) (/ (* PI (/ l_m F)) F))
(- (* PI l_m) (/ (/ (/ l_m (/ F PI)) -1.0) F)))))l_m = fabs(l);
l_s = copysign(1.0, l);
double code(double l_s, double F, double l_m) {
double tmp;
if ((((double) M_PI) * l_m) <= 50000000000000.0) {
tmp = (((double) M_PI) * l_m) - ((((double) M_PI) * (l_m / F)) / F);
} else {
tmp = (((double) M_PI) * l_m) - (((l_m / (F / ((double) M_PI))) / -1.0) / F);
}
return l_s * tmp;
}
l_m = Math.abs(l);
l_s = Math.copySign(1.0, l);
public static double code(double l_s, double F, double l_m) {
double tmp;
if ((Math.PI * l_m) <= 50000000000000.0) {
tmp = (Math.PI * l_m) - ((Math.PI * (l_m / F)) / F);
} else {
tmp = (Math.PI * l_m) - (((l_m / (F / Math.PI)) / -1.0) / F);
}
return l_s * tmp;
}
l_m = math.fabs(l) l_s = math.copysign(1.0, l) def code(l_s, F, l_m): tmp = 0 if (math.pi * l_m) <= 50000000000000.0: tmp = (math.pi * l_m) - ((math.pi * (l_m / F)) / F) else: tmp = (math.pi * l_m) - (((l_m / (F / math.pi)) / -1.0) / F) return l_s * tmp
l_m = abs(l) l_s = copysign(1.0, l) function code(l_s, F, l_m) tmp = 0.0 if (Float64(pi * l_m) <= 50000000000000.0) tmp = Float64(Float64(pi * l_m) - Float64(Float64(pi * Float64(l_m / F)) / F)); else tmp = Float64(Float64(pi * l_m) - Float64(Float64(Float64(l_m / Float64(F / pi)) / -1.0) / F)); end return Float64(l_s * tmp) end
l_m = abs(l); l_s = sign(l) * abs(1.0); function tmp_2 = code(l_s, F, l_m) tmp = 0.0; if ((pi * l_m) <= 50000000000000.0) tmp = (pi * l_m) - ((pi * (l_m / F)) / F); else tmp = (pi * l_m) - (((l_m / (F / pi)) / -1.0) / F); end tmp_2 = l_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
l_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[l]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[l$95$s_, F_, l$95$m_] := N[(l$95$s * If[LessEqual[N[(Pi * l$95$m), $MachinePrecision], 50000000000000.0], N[(N[(Pi * l$95$m), $MachinePrecision] - N[(N[(Pi * N[(l$95$m / F), $MachinePrecision]), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * l$95$m), $MachinePrecision] - N[(N[(N[(l$95$m / N[(F / Pi), $MachinePrecision]), $MachinePrecision] / -1.0), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
l_s = \mathsf{copysign}\left(1, \ell\right)
\\
l_s \cdot \begin{array}{l}
\mathbf{if}\;\pi \cdot l_m \leq 50000000000000:\\
\;\;\;\;\pi \cdot l_m - \frac{\pi \cdot \frac{l_m}{F}}{F}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot l_m - \frac{\frac{\frac{l_m}{\frac{F}{\pi}}}{-1}}{F}\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 5e13Initial program 78.6%
sqr-neg78.6%
associate-*l/78.7%
*-lft-identity78.7%
sqr-neg78.7%
Simplified78.7%
Taylor expanded in l around 0 74.4%
*-commutative74.4%
times-frac80.1%
Applied egg-rr80.1%
associate-*l/80.1%
Applied egg-rr80.1%
if 5e13 < (*.f64 (PI.f64) l) Initial program 70.4%
associate-/r/70.4%
associate-/l*70.4%
clear-num70.4%
add-sqr-sqrt27.8%
sqrt-prod68.3%
sqr-neg68.3%
sqrt-unprod40.5%
add-sqr-sqrt67.9%
neg-mul-167.9%
associate-/r*67.9%
Applied egg-rr67.9%
Taylor expanded in l around 0 53.3%
associate-/l*53.3%
Simplified53.3%
Final simplification73.6%
l_m = (fabs.f64 l) l_s = (copysign.f64 1 l) (FPCore (l_s F l_m) :precision binary64 (* l_s (- (* PI l_m) (* (/ l_m F) (/ PI F)))))
l_m = fabs(l);
l_s = copysign(1.0, l);
double code(double l_s, double F, double l_m) {
return l_s * ((((double) M_PI) * l_m) - ((l_m / F) * (((double) M_PI) / F)));
}
l_m = Math.abs(l);
l_s = Math.copySign(1.0, l);
public static double code(double l_s, double F, double l_m) {
return l_s * ((Math.PI * l_m) - ((l_m / F) * (Math.PI / F)));
}
l_m = math.fabs(l) l_s = math.copysign(1.0, l) def code(l_s, F, l_m): return l_s * ((math.pi * l_m) - ((l_m / F) * (math.pi / F)))
l_m = abs(l) l_s = copysign(1.0, l) function code(l_s, F, l_m) return Float64(l_s * Float64(Float64(pi * l_m) - Float64(Float64(l_m / F) * Float64(pi / F)))) end
l_m = abs(l); l_s = sign(l) * abs(1.0); function tmp = code(l_s, F, l_m) tmp = l_s * ((pi * l_m) - ((l_m / F) * (pi / F))); end
l_m = N[Abs[l], $MachinePrecision]
l_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[l]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[l$95$s_, F_, l$95$m_] := N[(l$95$s * N[(N[(Pi * l$95$m), $MachinePrecision] - N[(N[(l$95$m / F), $MachinePrecision] * N[(Pi / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
l_s = \mathsf{copysign}\left(1, \ell\right)
\\
l_s \cdot \left(\pi \cdot l_m - \frac{l_m}{F} \cdot \frac{\pi}{F}\right)
\end{array}
Initial program 76.6%
sqr-neg76.6%
associate-*l/76.7%
*-lft-identity76.7%
sqr-neg76.7%
Simplified76.7%
Taylor expanded in l around 0 68.3%
*-commutative68.3%
times-frac72.6%
Applied egg-rr72.6%
Final simplification72.6%
l_m = (fabs.f64 l) l_s = (copysign.f64 1 l) (FPCore (l_s F l_m) :precision binary64 (* l_s (- (* PI l_m) (/ (* PI (/ l_m F)) F))))
l_m = fabs(l);
l_s = copysign(1.0, l);
double code(double l_s, double F, double l_m) {
return l_s * ((((double) M_PI) * l_m) - ((((double) M_PI) * (l_m / F)) / F));
}
l_m = Math.abs(l);
l_s = Math.copySign(1.0, l);
public static double code(double l_s, double F, double l_m) {
return l_s * ((Math.PI * l_m) - ((Math.PI * (l_m / F)) / F));
}
l_m = math.fabs(l) l_s = math.copysign(1.0, l) def code(l_s, F, l_m): return l_s * ((math.pi * l_m) - ((math.pi * (l_m / F)) / F))
l_m = abs(l) l_s = copysign(1.0, l) function code(l_s, F, l_m) return Float64(l_s * Float64(Float64(pi * l_m) - Float64(Float64(pi * Float64(l_m / F)) / F))) end
l_m = abs(l); l_s = sign(l) * abs(1.0); function tmp = code(l_s, F, l_m) tmp = l_s * ((pi * l_m) - ((pi * (l_m / F)) / F)); end
l_m = N[Abs[l], $MachinePrecision]
l_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[l]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[l$95$s_, F_, l$95$m_] := N[(l$95$s * N[(N[(Pi * l$95$m), $MachinePrecision] - N[(N[(Pi * N[(l$95$m / F), $MachinePrecision]), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
l_s = \mathsf{copysign}\left(1, \ell\right)
\\
l_s \cdot \left(\pi \cdot l_m - \frac{\pi \cdot \frac{l_m}{F}}{F}\right)
\end{array}
Initial program 76.6%
sqr-neg76.6%
associate-*l/76.7%
*-lft-identity76.7%
sqr-neg76.7%
Simplified76.7%
Taylor expanded in l around 0 68.3%
*-commutative68.3%
times-frac72.6%
Applied egg-rr72.6%
associate-*l/72.6%
Applied egg-rr72.6%
Final simplification72.6%
herbie shell --seed 2024024
(FPCore (F l)
:name "VandenBroeck and Keller, Equation (6)"
:precision binary64
(- (* PI l) (* (/ 1.0 (* F F)) (tan (* PI l)))))