
(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 12 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
(if (<= (* PI l_m) 1e+16)
(fma PI l_m (/ (/ (tan (* PI l_m)) F) (- F)))
(+
(* PI l_m)
(/
(/ -1.0 F)
(/
F
(log
(exp (/ (sin (* PI l_m)) (fma -0.5 (pow (* PI l_m) 2.0) 1.0))))))))))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) <= 1e+16) {
tmp = fma(((double) M_PI), l_m, ((tan((((double) M_PI) * l_m)) / F) / -F));
} else {
tmp = (((double) M_PI) * l_m) + ((-1.0 / F) / (F / log(exp((sin((((double) M_PI) * l_m)) / fma(-0.5, pow((((double) M_PI) * l_m), 2.0), 1.0))))));
}
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) <= 1e+16) tmp = fma(pi, l_m, Float64(Float64(tan(Float64(pi * l_m)) / F) / Float64(-F))); else tmp = Float64(Float64(pi * l_m) + Float64(Float64(-1.0 / F) / Float64(F / log(exp(Float64(sin(Float64(pi * l_m)) / fma(-0.5, (Float64(pi * l_m) ^ 2.0), 1.0))))))); end return Float64(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], 1e+16], N[(Pi * l$95$m + N[(N[(N[Tan[N[(Pi * l$95$m), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision] / (-F)), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * l$95$m), $MachinePrecision] + N[(N[(-1.0 / F), $MachinePrecision] / N[(F / N[Log[N[Exp[N[(N[Sin[N[(Pi * l$95$m), $MachinePrecision]], $MachinePrecision] / N[(-0.5 * N[Power[N[(Pi * l$95$m), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]], $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 \begin{array}{l}
\mathbf{if}\;\pi \cdot l_m \leq 10^{+16}:\\
\;\;\;\;\mathsf{fma}\left(\pi, l_m, \frac{\frac{\tan \left(\pi \cdot l_m\right)}{F}}{-F}\right)\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot l_m + \frac{\frac{-1}{F}}{\frac{F}{\log \left(e^{\frac{\sin \left(\pi \cdot l_m\right)}{\mathsf{fma}\left(-0.5, {\left(\pi \cdot l_m\right)}^{2}, 1\right)}}\right)}}\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 1e16Initial program 85.4%
fma-neg85.4%
distribute-lft-neg-in85.4%
sqr-neg85.4%
distribute-neg-frac85.4%
metadata-eval85.4%
distribute-lft-neg-out85.4%
neg-mul-185.4%
associate-/r*85.4%
metadata-eval85.4%
associate-*l/85.9%
*-lft-identity85.9%
associate-/r*91.5%
Simplified91.5%
if 1e16 < (*.f64 (PI.f64) l) Initial program 62.5%
associate-/r/62.5%
associate-/l*62.5%
clear-num62.5%
add-sqr-sqrt23.7%
sqrt-prod62.8%
sqr-neg62.8%
sqrt-unprod39.0%
add-sqr-sqrt62.6%
div-inv62.6%
clear-num62.6%
associate-*l/62.6%
*-un-lft-identity62.6%
add-sqr-sqrt39.0%
sqrt-unprod62.8%
sqr-neg62.8%
sqrt-prod23.7%
add-sqr-sqrt62.5%
Applied egg-rr62.5%
tan-quot62.5%
clear-num62.5%
Applied egg-rr62.5%
Taylor expanded in l around 0 86.6%
+-commutative86.6%
fma-def86.6%
*-commutative86.6%
unpow286.6%
unpow286.6%
swap-sqr86.6%
unpow286.6%
*-commutative86.6%
Simplified86.6%
clear-num86.6%
add-log-exp99.6%
*-commutative99.6%
Applied egg-rr99.6%
Final simplification93.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)
(/
(/ -1.0 F)
(/
F
(/
1.0
(/ (fma -0.5 (sqrt (pow (* PI l_m) 4.0)) 1.0) (sin (* 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 / (1.0 / (fma(-0.5, sqrt(pow((((double) M_PI) * l_m), 4.0)), 1.0) / sin((((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) / Float64(F / Float64(1.0 / Float64(fma(-0.5, sqrt((Float64(pi * l_m) ^ 4.0)), 1.0) / sin(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[(F / N[(1.0 / N[(N[(-0.5 * N[Sqrt[N[Power[N[(Pi * l$95$m), $MachinePrecision], 4.0], $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision] / N[Sin[N[(Pi * l$95$m), $MachinePrecision]], $MachinePrecision]), $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}{\frac{1}{\frac{\mathsf{fma}\left(-0.5, \sqrt{{\left(\pi \cdot l_m\right)}^{4}}, 1\right)}{\sin \left(\pi \cdot l_m\right)}}}}\right)
\end{array}
Initial program 80.0%
associate-/r/80.4%
associate-/l*84.7%
clear-num84.7%
add-sqr-sqrt40.7%
sqrt-prod65.7%
sqr-neg65.7%
sqrt-unprod27.1%
add-sqr-sqrt54.3%
div-inv54.3%
clear-num54.3%
associate-*l/54.3%
*-un-lft-identity54.3%
add-sqr-sqrt27.1%
sqrt-unprod65.7%
sqr-neg65.7%
sqrt-prod40.7%
add-sqr-sqrt84.7%
Applied egg-rr84.7%
tan-quot84.7%
clear-num84.7%
Applied egg-rr84.7%
Taylor expanded in l around 0 93.5%
+-commutative93.5%
fma-def93.5%
*-commutative93.5%
unpow293.5%
unpow293.5%
swap-sqr93.5%
unpow293.5%
*-commutative93.5%
Simplified93.5%
add-sqr-sqrt93.5%
sqrt-unprod95.0%
pow-prod-up95.0%
metadata-eval95.0%
Applied egg-rr95.0%
Final simplification95.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 (/ 1.0 (/ (fma -0.5 (pow (* PI l_m) 2.0) 1.0) (sin (* 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 / (1.0 / (fma(-0.5, pow((((double) M_PI) * l_m), 2.0), 1.0) / sin((((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) / Float64(F / Float64(1.0 / Float64(fma(-0.5, (Float64(pi * l_m) ^ 2.0), 1.0) / sin(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[(F / N[(1.0 / N[(N[(-0.5 * N[Power[N[(Pi * l$95$m), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision] / N[Sin[N[(Pi * l$95$m), $MachinePrecision]], $MachinePrecision]), $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}{\frac{1}{\frac{\mathsf{fma}\left(-0.5, {\left(\pi \cdot l_m\right)}^{2}, 1\right)}{\sin \left(\pi \cdot l_m\right)}}}}\right)
\end{array}
Initial program 80.0%
associate-/r/80.4%
associate-/l*84.7%
clear-num84.7%
add-sqr-sqrt40.7%
sqrt-prod65.7%
sqr-neg65.7%
sqrt-unprod27.1%
add-sqr-sqrt54.3%
div-inv54.3%
clear-num54.3%
associate-*l/54.3%
*-un-lft-identity54.3%
add-sqr-sqrt27.1%
sqrt-unprod65.7%
sqr-neg65.7%
sqrt-prod40.7%
add-sqr-sqrt84.7%
Applied egg-rr84.7%
tan-quot84.7%
clear-num84.7%
Applied egg-rr84.7%
Taylor expanded in l around 0 93.5%
+-commutative93.5%
fma-def93.5%
*-commutative93.5%
unpow293.5%
unpow293.5%
swap-sqr93.5%
unpow293.5%
*-commutative93.5%
Simplified93.5%
Final simplification93.5%
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) 2e+56)
(fma PI l_m (/ (/ (tan (* PI l_m)) F) (- F)))
(+
(* PI l_m)
(/
(/ -1.0 F)
(/ F (* (sin (* PI l_m)) (/ -2.0 (pow (* PI l_m) 2.0)))))))))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) <= 2e+56) {
tmp = fma(((double) M_PI), l_m, ((tan((((double) M_PI) * l_m)) / F) / -F));
} else {
tmp = (((double) M_PI) * l_m) + ((-1.0 / F) / (F / (sin((((double) M_PI) * l_m)) * (-2.0 / pow((((double) M_PI) * l_m), 2.0)))));
}
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) <= 2e+56) tmp = fma(pi, l_m, Float64(Float64(tan(Float64(pi * l_m)) / F) / Float64(-F))); else tmp = Float64(Float64(pi * l_m) + Float64(Float64(-1.0 / F) / Float64(F / Float64(sin(Float64(pi * l_m)) * Float64(-2.0 / (Float64(pi * l_m) ^ 2.0)))))); end return Float64(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], 2e+56], N[(Pi * l$95$m + N[(N[(N[Tan[N[(Pi * l$95$m), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision] / (-F)), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * l$95$m), $MachinePrecision] + N[(N[(-1.0 / F), $MachinePrecision] / N[(F / N[(N[Sin[N[(Pi * l$95$m), $MachinePrecision]], $MachinePrecision] * N[(-2.0 / N[Power[N[(Pi * l$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $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 \begin{array}{l}
\mathbf{if}\;\pi \cdot l_m \leq 2 \cdot 10^{+56}:\\
\;\;\;\;\mathsf{fma}\left(\pi, l_m, \frac{\frac{\tan \left(\pi \cdot l_m\right)}{F}}{-F}\right)\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot l_m + \frac{\frac{-1}{F}}{\frac{F}{\sin \left(\pi \cdot l_m\right) \cdot \frac{-2}{{\left(\pi \cdot l_m\right)}^{2}}}}\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 2.00000000000000018e56Initial program 83.0%
fma-neg83.0%
distribute-lft-neg-in83.0%
sqr-neg83.0%
distribute-neg-frac83.0%
metadata-eval83.0%
distribute-lft-neg-out83.0%
neg-mul-183.0%
associate-/r*83.0%
metadata-eval83.0%
associate-*l/83.5%
*-lft-identity83.5%
associate-/r*88.9%
Simplified88.9%
if 2.00000000000000018e56 < (*.f64 (PI.f64) l) Initial program 68.9%
associate-/r/68.9%
associate-/l*68.9%
clear-num68.9%
add-sqr-sqrt26.1%
sqrt-prod69.4%
sqr-neg69.4%
sqrt-unprod43.3%
add-sqr-sqrt69.4%
div-inv69.4%
clear-num69.4%
associate-*l/69.4%
*-un-lft-identity69.4%
add-sqr-sqrt43.3%
sqrt-unprod69.4%
sqr-neg69.4%
sqrt-prod26.1%
add-sqr-sqrt68.9%
Applied egg-rr68.9%
tan-quot68.9%
clear-num68.9%
Applied egg-rr68.9%
Taylor expanded in l around 0 95.9%
+-commutative95.9%
fma-def95.9%
*-commutative95.9%
unpow295.9%
unpow295.9%
swap-sqr95.9%
unpow295.9%
*-commutative95.9%
Simplified95.9%
Taylor expanded in l around inf 95.9%
unpow295.9%
unpow295.9%
swap-sqr95.9%
unpow295.9%
associate-*r/95.9%
*-rgt-identity95.9%
times-frac95.9%
rem-square-sqrt50.0%
associate-*r/50.0%
/-rgt-identity50.0%
rem-square-sqrt95.9%
Simplified95.9%
Final simplification90.4%
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 80.0%
fma-neg80.0%
distribute-lft-neg-in80.0%
sqr-neg80.0%
distribute-neg-frac80.0%
metadata-eval80.0%
distribute-lft-neg-out80.0%
neg-mul-180.0%
associate-/r*80.0%
metadata-eval80.0%
associate-*l/80.4%
*-lft-identity80.4%
associate-/r*84.7%
Simplified84.7%
Final simplification84.7%
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) 1.5e-27)
(+ (* PI l_m) (* (/ l_m (/ F PI)) (/ -1.0 F)))
(- (* PI l_m) (* (tan (* PI l_m)) (/ 1.0 (* 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) <= 1.5e-27) {
tmp = (((double) M_PI) * l_m) + ((l_m / (F / ((double) M_PI))) * (-1.0 / F));
} else {
tmp = (((double) M_PI) * l_m) - (tan((((double) M_PI) * l_m)) * (1.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 tmp;
if ((Math.PI * l_m) <= 1.5e-27) {
tmp = (Math.PI * l_m) + ((l_m / (F / Math.PI)) * (-1.0 / F));
} else {
tmp = (Math.PI * l_m) - (Math.tan((Math.PI * l_m)) * (1.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): tmp = 0 if (math.pi * l_m) <= 1.5e-27: tmp = (math.pi * l_m) + ((l_m / (F / math.pi)) * (-1.0 / F)) else: tmp = (math.pi * l_m) - (math.tan((math.pi * l_m)) * (1.0 / (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) <= 1.5e-27) tmp = Float64(Float64(pi * l_m) + Float64(Float64(l_m / Float64(F / pi)) * Float64(-1.0 / F))); else tmp = Float64(Float64(pi * l_m) - Float64(tan(Float64(pi * l_m)) * Float64(1.0 / 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) <= 1.5e-27) tmp = (pi * l_m) + ((l_m / (F / pi)) * (-1.0 / F)); else tmp = (pi * l_m) - (tan((pi * l_m)) * (1.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_] := N[(l$95$s * If[LessEqual[N[(Pi * l$95$m), $MachinePrecision], 1.5e-27], N[(N[(Pi * l$95$m), $MachinePrecision] + N[(N[(l$95$m / N[(F / Pi), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * l$95$m), $MachinePrecision] - N[(N[Tan[N[(Pi * l$95$m), $MachinePrecision]], $MachinePrecision] * N[(1.0 / N[(F * F), $MachinePrecision]), $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 1.5 \cdot 10^{-27}:\\
\;\;\;\;\pi \cdot l_m + \frac{l_m}{\frac{F}{\pi}} \cdot \frac{-1}{F}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot l_m - \tan \left(\pi \cdot l_m\right) \cdot \frac{1}{F \cdot F}\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 1.5000000000000001e-27Initial program 85.0%
sqr-neg85.0%
associate-*l/85.5%
*-lft-identity85.5%
sqr-neg85.5%
Simplified85.5%
Taylor expanded in l around 0 82.4%
associate-/r*88.3%
div-inv88.3%
associate-/l*88.4%
Applied egg-rr88.4%
if 1.5000000000000001e-27 < (*.f64 (PI.f64) l) Initial program 66.6%
Final simplification82.5%
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) 2e-28)
(+ (* PI l_m) (* (/ l_m (/ F PI)) (/ -1.0 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) <= 2e-28) {
tmp = (((double) M_PI) * l_m) + ((l_m / (F / ((double) M_PI))) * (-1.0 / 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) <= 2e-28) {
tmp = (Math.PI * l_m) + ((l_m / (F / Math.PI)) * (-1.0 / 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) <= 2e-28: tmp = (math.pi * l_m) + ((l_m / (F / math.pi)) * (-1.0 / 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) <= 2e-28) tmp = Float64(Float64(pi * l_m) + Float64(Float64(l_m / Float64(F / pi)) * Float64(-1.0 / 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) <= 2e-28) tmp = (pi * l_m) + ((l_m / (F / pi)) * (-1.0 / 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], 2e-28], N[(N[(Pi * l$95$m), $MachinePrecision] + N[(N[(l$95$m / N[(F / Pi), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / 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 2 \cdot 10^{-28}:\\
\;\;\;\;\pi \cdot l_m + \frac{l_m}{\frac{F}{\pi}} \cdot \frac{-1}{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) < 1.99999999999999994e-28Initial program 84.9%
sqr-neg84.9%
associate-*l/85.4%
*-lft-identity85.4%
sqr-neg85.4%
Simplified85.4%
Taylor expanded in l around 0 82.3%
associate-/r*88.3%
div-inv88.3%
associate-/l*88.3%
Applied egg-rr88.3%
if 1.99999999999999994e-28 < (*.f64 (PI.f64) l) Initial program 67.0%
sqr-neg67.0%
associate-*l/67.0%
*-lft-identity67.0%
sqr-neg67.0%
Simplified67.0%
Final simplification82.5%
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 80.0%
associate-/r/80.4%
associate-/l*84.7%
clear-num84.7%
add-sqr-sqrt40.7%
sqrt-prod65.7%
sqr-neg65.7%
sqrt-unprod27.1%
add-sqr-sqrt54.3%
div-inv54.3%
clear-num54.3%
associate-*l/54.3%
*-un-lft-identity54.3%
add-sqr-sqrt27.1%
sqrt-unprod65.7%
sqr-neg65.7%
sqrt-prod40.7%
add-sqr-sqrt84.7%
Applied egg-rr84.7%
Final simplification84.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) (* (/ 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) {
return l_s * ((((double) M_PI) * l_m) + ((l_m / (F / ((double) M_PI))) * (-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) + ((l_m / (F / Math.PI)) * (-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) + ((l_m / (F / math.pi)) * (-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(l_m / Float64(F / pi)) * 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) + ((l_m / (F / pi)) * (-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[(l$95$m / N[(F / Pi), $MachinePrecision]), $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{l_m}{\frac{F}{\pi}} \cdot \frac{-1}{F}\right)
\end{array}
Initial program 80.0%
sqr-neg80.0%
associate-*l/80.4%
*-lft-identity80.4%
sqr-neg80.4%
Simplified80.4%
Taylor expanded in l around 0 74.4%
associate-/r*78.7%
div-inv78.7%
associate-/l*78.7%
Applied egg-rr78.7%
Final simplification78.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) (* (/ 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 80.0%
sqr-neg80.0%
associate-*l/80.4%
*-lft-identity80.4%
sqr-neg80.4%
Simplified80.4%
Taylor expanded in l around 0 74.4%
*-commutative74.4%
times-frac78.6%
Applied egg-rr78.6%
Final simplification78.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 (* F (/ F 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) - (((double) M_PI) / (F * (F / 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) - (Math.PI / (F * (F / 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) - (math.pi / (F * (F / 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(pi / Float64(F * Float64(F / 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) - (pi / (F * (F / 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[(Pi / N[(F * N[(F / l$95$m), $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{\pi}{F \cdot \frac{F}{l_m}}\right)
\end{array}
Initial program 80.0%
sqr-neg80.0%
associate-*l/80.4%
*-lft-identity80.4%
sqr-neg80.4%
Simplified80.4%
Taylor expanded in l around 0 74.4%
*-commutative74.4%
times-frac78.6%
Applied egg-rr78.6%
*-commutative78.6%
clear-num78.6%
frac-times78.7%
*-un-lft-identity78.7%
Applied egg-rr78.7%
Final simplification78.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) (/ 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(pi / Float64(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[(Pi / N[(F / N[(l$95$m / F), $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{\pi}{\frac{F}{\frac{l_m}{F}}}\right)
\end{array}
Initial program 80.0%
sqr-neg80.0%
associate-*l/80.4%
*-lft-identity80.4%
sqr-neg80.4%
Simplified80.4%
Taylor expanded in l around 0 74.4%
*-commutative74.4%
times-frac78.6%
Applied egg-rr78.6%
associate-*l/78.7%
associate-/l*78.7%
Applied egg-rr78.7%
Final simplification78.7%
herbie shell --seed 2024019
(FPCore (F l)
:name "VandenBroeck and Keller, Equation (6)"
:precision binary64
(- (* PI l) (* (/ 1.0 (* F F)) (tan (* PI l)))))