
(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 7 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
(let* ((t_0 (* -0.5 (* (pow l_m 2.0) (pow PI 2.0)))) (t_1 (sin (* PI l_m))))
(*
l_s
(if (<= (* PI l_m) 1e+123)
(-
(* PI l_m)
(/
(/
(/
t_1
(+
1.0
(+ t_0 (* 0.041666666666666664 (* (pow l_m 4.0) (pow PI 4.0))))))
F)
F))
(- (* PI l_m) (/ (/ (/ t_1 (+ 1.0 t_0)) F) F))))))l_m = fabs(l);
l_s = copysign(1.0, l);
double code(double l_s, double F, double l_m) {
double t_0 = -0.5 * (pow(l_m, 2.0) * pow(((double) M_PI), 2.0));
double t_1 = sin((((double) M_PI) * l_m));
double tmp;
if ((((double) M_PI) * l_m) <= 1e+123) {
tmp = (((double) M_PI) * l_m) - (((t_1 / (1.0 + (t_0 + (0.041666666666666664 * (pow(l_m, 4.0) * pow(((double) M_PI), 4.0)))))) / F) / F);
} else {
tmp = (((double) M_PI) * l_m) - (((t_1 / (1.0 + t_0)) / 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 t_0 = -0.5 * (Math.pow(l_m, 2.0) * Math.pow(Math.PI, 2.0));
double t_1 = Math.sin((Math.PI * l_m));
double tmp;
if ((Math.PI * l_m) <= 1e+123) {
tmp = (Math.PI * l_m) - (((t_1 / (1.0 + (t_0 + (0.041666666666666664 * (Math.pow(l_m, 4.0) * Math.pow(Math.PI, 4.0)))))) / F) / F);
} else {
tmp = (Math.PI * l_m) - (((t_1 / (1.0 + t_0)) / 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): t_0 = -0.5 * (math.pow(l_m, 2.0) * math.pow(math.pi, 2.0)) t_1 = math.sin((math.pi * l_m)) tmp = 0 if (math.pi * l_m) <= 1e+123: tmp = (math.pi * l_m) - (((t_1 / (1.0 + (t_0 + (0.041666666666666664 * (math.pow(l_m, 4.0) * math.pow(math.pi, 4.0)))))) / F) / F) else: tmp = (math.pi * l_m) - (((t_1 / (1.0 + t_0)) / F) / F) return l_s * tmp
l_m = abs(l) l_s = copysign(1.0, l) function code(l_s, F, l_m) t_0 = Float64(-0.5 * Float64((l_m ^ 2.0) * (pi ^ 2.0))) t_1 = sin(Float64(pi * l_m)) tmp = 0.0 if (Float64(pi * l_m) <= 1e+123) tmp = Float64(Float64(pi * l_m) - Float64(Float64(Float64(t_1 / Float64(1.0 + Float64(t_0 + Float64(0.041666666666666664 * Float64((l_m ^ 4.0) * (pi ^ 4.0)))))) / F) / F)); else tmp = Float64(Float64(pi * l_m) - Float64(Float64(Float64(t_1 / Float64(1.0 + t_0)) / 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) t_0 = -0.5 * ((l_m ^ 2.0) * (pi ^ 2.0)); t_1 = sin((pi * l_m)); tmp = 0.0; if ((pi * l_m) <= 1e+123) tmp = (pi * l_m) - (((t_1 / (1.0 + (t_0 + (0.041666666666666664 * ((l_m ^ 4.0) * (pi ^ 4.0)))))) / F) / F); else tmp = (pi * l_m) - (((t_1 / (1.0 + t_0)) / 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_] := Block[{t$95$0 = N[(-0.5 * N[(N[Power[l$95$m, 2.0], $MachinePrecision] * N[Power[Pi, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(Pi * l$95$m), $MachinePrecision]], $MachinePrecision]}, N[(l$95$s * If[LessEqual[N[(Pi * l$95$m), $MachinePrecision], 1e+123], N[(N[(Pi * l$95$m), $MachinePrecision] - N[(N[(N[(t$95$1 / N[(1.0 + N[(t$95$0 + N[(0.041666666666666664 * N[(N[Power[l$95$m, 4.0], $MachinePrecision] * N[Power[Pi, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * l$95$m), $MachinePrecision] - N[(N[(N[(t$95$1 / N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]]
\begin{array}{l}
l_m = \left|\ell\right|
\\
l_s = \mathsf{copysign}\left(1, \ell\right)
\\
\begin{array}{l}
t_0 := -0.5 \cdot \left({l\_m}^{2} \cdot {\pi}^{2}\right)\\
t_1 := \sin \left(\pi \cdot l\_m\right)\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;\pi \cdot l\_m \leq 10^{+123}:\\
\;\;\;\;\pi \cdot l\_m - \frac{\frac{\frac{t\_1}{1 + \left(t\_0 + 0.041666666666666664 \cdot \left({l\_m}^{4} \cdot {\pi}^{4}\right)\right)}}{F}}{F}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot l\_m - \frac{\frac{\frac{t\_1}{1 + t\_0}}{F}}{F}\\
\end{array}
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 9.99999999999999978e122Initial program 77.5%
associate-*l/77.9%
*-un-lft-identity77.9%
associate-/r*82.7%
Applied egg-rr82.7%
tan-quot82.7%
Applied egg-rr82.7%
Taylor expanded in l around 0 77.4%
if 9.99999999999999978e122 < (*.f64 (PI.f64) l) Initial program 72.1%
associate-*l/72.1%
*-un-lft-identity72.1%
associate-/r*72.1%
Applied egg-rr72.1%
tan-quot72.1%
Applied egg-rr72.1%
Taylor expanded in l around 0 99.6%
Final simplification80.7%
l_m = (fabs.f64 l)
l_s = (copysign.f64 1 l)
(FPCore (l_s F l_m)
:precision binary64
(*
l_s
(-
(* PI l_m)
(/
(/ (/ (sin (* PI l_m)) (+ 1.0 (* -0.5 (* (pow l_m 2.0) (pow PI 2.0))))) 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) - (((sin((((double) M_PI) * l_m)) / (1.0 + (-0.5 * (pow(l_m, 2.0) * pow(((double) M_PI), 2.0))))) / 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.sin((Math.PI * l_m)) / (1.0 + (-0.5 * (Math.pow(l_m, 2.0) * Math.pow(Math.PI, 2.0))))) / 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.sin((math.pi * l_m)) / (1.0 + (-0.5 * (math.pow(l_m, 2.0) * math.pow(math.pi, 2.0))))) / 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(Float64(sin(Float64(pi * l_m)) / Float64(1.0 + Float64(-0.5 * Float64((l_m ^ 2.0) * (pi ^ 2.0))))) / 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) - (((sin((pi * l_m)) / (1.0 + (-0.5 * ((l_m ^ 2.0) * (pi ^ 2.0))))) / 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[(N[Sin[N[(Pi * l$95$m), $MachinePrecision]], $MachinePrecision] / N[(1.0 + N[(-0.5 * N[(N[Power[l$95$m, 2.0], $MachinePrecision] * N[Power[Pi, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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{\frac{\sin \left(\pi \cdot l\_m\right)}{1 + -0.5 \cdot \left({l\_m}^{2} \cdot {\pi}^{2}\right)}}{F}}{F}\right)
\end{array}
Initial program 76.7%
associate-*l/77.1%
*-un-lft-identity77.1%
associate-/r*81.1%
Applied egg-rr81.1%
tan-quot81.1%
Applied egg-rr81.1%
Taylor expanded in l around 0 90.9%
Final simplification90.9%
l_m = (fabs.f64 l) l_s = (copysign.f64 1 l) (FPCore (l_s F l_m) :precision binary64 (* l_s (fma 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 * fma(((double) M_PI), l_m, ((tan((((double) M_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 * fma(pi, l_m, Float64(Float64(tan(Float64(pi * l_m)) / F) / Float64(-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[(Pi * l$95$m + 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 \mathsf{fma}\left(\pi, l\_m, \frac{\frac{\tan \left(\pi \cdot l\_m\right)}{F}}{-F}\right)
\end{array}
Initial program 76.7%
fma-neg76.7%
distribute-lft-neg-in76.7%
sqr-neg76.7%
distribute-neg-frac76.7%
metadata-eval76.7%
distribute-lft-neg-out76.7%
neg-mul-176.7%
associate-/r*76.7%
metadata-eval76.7%
associate-*l/77.1%
*-lft-identity77.1%
associate-/r*81.1%
Simplified81.1%
Final simplification81.1%
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-133)
(- (* PI l_m) (* (/ PI F) (/ l_m 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-133) {
tmp = (((double) M_PI) * l_m) - ((((double) M_PI) / F) * (l_m / 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-133) {
tmp = (Math.PI * l_m) - ((Math.PI / F) * (l_m / 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-133: tmp = (math.pi * l_m) - ((math.pi / F) * (l_m / 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-133) tmp = Float64(Float64(pi * l_m) - Float64(Float64(pi / F) * Float64(l_m / 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-133) tmp = (pi * l_m) - ((pi / F) * (l_m / 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-133], N[(N[(Pi * l$95$m), $MachinePrecision] - N[(N[(Pi / F), $MachinePrecision] * N[(l$95$m / F), $MachinePrecision]), $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^{-133}:\\
\;\;\;\;\pi \cdot l\_m - \frac{\pi}{F} \cdot \frac{l\_m}{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-133Initial program 77.2%
sqr-neg77.2%
associate-*l/77.7%
*-lft-identity77.7%
sqr-neg77.7%
Simplified77.7%
Taylor expanded in l around 0 73.7%
*-commutative73.7%
times-frac79.6%
Applied egg-rr79.6%
if 4.9999999999999999e-133 < (*.f64 (PI.f64) l) Initial program 75.6%
sqr-neg75.6%
associate-*l/75.6%
*-lft-identity75.6%
sqr-neg75.6%
Simplified75.6%
Final simplification78.4%
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) (/ -1.0 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) * (-1.0 / 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) * (-1.0 / 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) * (-1.0 / 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) * Float64(-1.0 / 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) * (-1.0 / 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] * N[(-1.0 / 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{\tan \left(\pi \cdot l\_m\right)}{F} \cdot \frac{-1}{F}\right)
\end{array}
Initial program 76.7%
sqr-neg76.7%
associate-*l/77.1%
*-lft-identity77.1%
sqr-neg77.1%
Simplified77.1%
associate-/r*81.1%
div-inv81.1%
Applied egg-rr81.1%
Final simplification81.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) (/ (/ (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.7%
associate-*l/77.1%
*-un-lft-identity77.1%
associate-/r*81.1%
Applied egg-rr81.1%
Final simplification81.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) (* (/ PI F) (/ l_m 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) / F) * (l_m / 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 / F) * (l_m / 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 / F) * (l_m / 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 / F) * Float64(l_m / 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 / F) * (l_m / 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 / F), $MachinePrecision] * N[(l$95$m / 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{\pi}{F} \cdot \frac{l\_m}{F}\right)
\end{array}
Initial program 76.7%
sqr-neg76.7%
associate-*l/77.1%
*-lft-identity77.1%
sqr-neg77.1%
Simplified77.1%
Taylor expanded in l around 0 69.7%
*-commutative69.7%
times-frac73.8%
Applied egg-rr73.8%
Final simplification73.8%
herbie shell --seed 2024027
(FPCore (F l)
:name "VandenBroeck and Keller, Equation (6)"
:precision binary64
(- (* PI l) (* (/ 1.0 (* F F)) (tan (* PI l)))))