
(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 13 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 (- (* PI l) (* (/ (/ (sin (* PI l)) (fma -0.5 (pow (log1p (expm1 (* PI l))) 2.0) 1.0)) F) (/ 1.0 F))))
double code(double F, double l) {
return (((double) M_PI) * l) - (((sin((((double) M_PI) * l)) / fma(-0.5, pow(log1p(expm1((((double) M_PI) * l))), 2.0), 1.0)) / F) * (1.0 / F));
}
function code(F, l) return Float64(Float64(pi * l) - Float64(Float64(Float64(sin(Float64(pi * l)) / fma(-0.5, (log1p(expm1(Float64(pi * l))) ^ 2.0), 1.0)) / F) * Float64(1.0 / F))) end
code[F_, l_] := N[(N[(Pi * l), $MachinePrecision] - N[(N[(N[(N[Sin[N[(Pi * l), $MachinePrecision]], $MachinePrecision] / N[(-0.5 * N[Power[N[Log[1 + N[(Exp[N[(Pi * l), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / F), $MachinePrecision] * N[(1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot \ell - \frac{\frac{\sin \left(\pi \cdot \ell\right)}{\mathsf{fma}\left(-0.5, {\left(\mathsf{log1p}\left(\mathsf{expm1}\left(\pi \cdot \ell\right)\right)\right)}^{2}, 1\right)}}{F} \cdot \frac{1}{F}
\end{array}
Initial program 79.5%
sqr-neg79.5%
associate-*l/79.6%
*-lft-identity79.6%
sqr-neg79.6%
Simplified79.6%
tan-quot79.6%
clear-num79.6%
Applied egg-rr79.6%
Taylor expanded in l around 0 83.2%
+-commutative83.2%
fma-def83.2%
*-commutative83.2%
unpow283.2%
unpow283.2%
swap-sqr83.2%
unpow283.2%
*-commutative83.2%
Simplified83.2%
associate-/r*93.3%
div-inv93.4%
clear-num93.3%
*-commutative93.3%
Applied egg-rr93.3%
*-commutative93.3%
log1p-expm1-u98.6%
Applied egg-rr98.6%
Final simplification98.6%
(FPCore (F l) :precision binary64 (if (or (<= (* PI l) -1e+48) (not (<= (* PI l) 5000000.0))) (- (* PI l) (* (/ (sin (* PI l)) F) (/ -2.0 (* F (pow (* PI l) 2.0))))) (fma PI l (/ (/ (tan (* PI l)) (- F)) F))))
double code(double F, double l) {
double tmp;
if (((((double) M_PI) * l) <= -1e+48) || !((((double) M_PI) * l) <= 5000000.0)) {
tmp = (((double) M_PI) * l) - ((sin((((double) M_PI) * l)) / F) * (-2.0 / (F * pow((((double) M_PI) * l), 2.0))));
} else {
tmp = fma(((double) M_PI), l, ((tan((((double) M_PI) * l)) / -F) / F));
}
return tmp;
}
function code(F, l) tmp = 0.0 if ((Float64(pi * l) <= -1e+48) || !(Float64(pi * l) <= 5000000.0)) tmp = Float64(Float64(pi * l) - Float64(Float64(sin(Float64(pi * l)) / F) * Float64(-2.0 / Float64(F * (Float64(pi * l) ^ 2.0))))); else tmp = fma(pi, l, Float64(Float64(tan(Float64(pi * l)) / Float64(-F)) / F)); end return tmp end
code[F_, l_] := If[Or[LessEqual[N[(Pi * l), $MachinePrecision], -1e+48], N[Not[LessEqual[N[(Pi * l), $MachinePrecision], 5000000.0]], $MachinePrecision]], N[(N[(Pi * l), $MachinePrecision] - N[(N[(N[Sin[N[(Pi * l), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision] * N[(-2.0 / N[(F * N[Power[N[(Pi * l), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(Pi * l + 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 -1 \cdot 10^{+48} \lor \neg \left(\pi \cdot \ell \leq 5000000\right):\\
\;\;\;\;\pi \cdot \ell - \frac{\sin \left(\pi \cdot \ell\right)}{F} \cdot \frac{-2}{F \cdot {\left(\pi \cdot \ell\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\pi, \ell, \frac{\frac{\tan \left(\pi \cdot \ell\right)}{-F}}{F}\right)\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < -1.00000000000000004e48 or 5e6 < (*.f64 (PI.f64) l) Initial program 63.4%
sqr-neg63.4%
associate-*l/63.4%
*-lft-identity63.4%
sqr-neg63.4%
Simplified63.4%
tan-quot63.4%
clear-num63.4%
Applied egg-rr63.4%
Taylor expanded in l around 0 72.9%
+-commutative72.9%
fma-def72.9%
*-commutative72.9%
unpow272.9%
unpow272.9%
swap-sqr72.9%
unpow272.9%
*-commutative72.9%
Simplified72.9%
associate-/r/72.9%
times-frac90.7%
*-commutative90.7%
Applied egg-rr90.7%
Taylor expanded in l around inf 90.7%
unpow290.7%
unpow290.7%
swap-sqr90.7%
unpow290.7%
Simplified90.7%
if -1.00000000000000004e48 < (*.f64 (PI.f64) l) < 5e6Initial program 93.7%
*-commutative93.7%
sqr-neg93.7%
*-commutative93.7%
fma-neg93.7%
associate-*l/93.8%
times-frac97.1%
distribute-lft-neg-in97.1%
neg-mul-197.1%
associate-/r*97.1%
metadata-eval97.1%
distribute-neg-frac97.1%
metadata-eval97.1%
times-frac93.8%
Simplified97.1%
Final simplification94.1%
(FPCore (F l) :precision binary64 (+ (* PI l) (* (/ (/ (sin (* PI l)) (fma -0.5 (sqrt (pow (* PI l) 4.0)) 1.0)) F) (/ -1.0 F))))
double code(double F, double l) {
return (((double) M_PI) * l) + (((sin((((double) M_PI) * l)) / fma(-0.5, sqrt(pow((((double) M_PI) * l), 4.0)), 1.0)) / F) * (-1.0 / F));
}
function code(F, l) return Float64(Float64(pi * l) + Float64(Float64(Float64(sin(Float64(pi * l)) / fma(-0.5, sqrt((Float64(pi * l) ^ 4.0)), 1.0)) / F) * Float64(-1.0 / F))) end
code[F_, l_] := N[(N[(Pi * l), $MachinePrecision] + N[(N[(N[(N[Sin[N[(Pi * l), $MachinePrecision]], $MachinePrecision] / N[(-0.5 * N[Sqrt[N[Power[N[(Pi * l), $MachinePrecision], 4.0], $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / F), $MachinePrecision] * N[(-1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot \ell + \frac{\frac{\sin \left(\pi \cdot \ell\right)}{\mathsf{fma}\left(-0.5, \sqrt{{\left(\pi \cdot \ell\right)}^{4}}, 1\right)}}{F} \cdot \frac{-1}{F}
\end{array}
Initial program 79.5%
sqr-neg79.5%
associate-*l/79.6%
*-lft-identity79.6%
sqr-neg79.6%
Simplified79.6%
tan-quot79.6%
clear-num79.6%
Applied egg-rr79.6%
Taylor expanded in l around 0 83.2%
+-commutative83.2%
fma-def83.2%
*-commutative83.2%
unpow283.2%
unpow283.2%
swap-sqr83.2%
unpow283.2%
*-commutative83.2%
Simplified83.2%
associate-/r*93.3%
div-inv93.4%
clear-num93.3%
*-commutative93.3%
Applied egg-rr93.3%
add-sqr-sqrt93.3%
sqrt-unprod96.0%
*-commutative96.0%
*-commutative96.0%
pow-prod-up96.0%
*-commutative96.0%
metadata-eval96.0%
Applied egg-rr96.0%
Final simplification96.0%
(FPCore (F l) :precision binary64 (- (* PI l) (* (/ (/ 1.0 (fma -0.5 (pow (* PI l) 2.0) 1.0)) F) (/ (sin (* PI l)) F))))
double code(double F, double l) {
return (((double) M_PI) * l) - (((1.0 / fma(-0.5, pow((((double) M_PI) * l), 2.0), 1.0)) / F) * (sin((((double) M_PI) * l)) / F));
}
function code(F, l) return Float64(Float64(pi * l) - Float64(Float64(Float64(1.0 / fma(-0.5, (Float64(pi * l) ^ 2.0), 1.0)) / F) * Float64(sin(Float64(pi * l)) / F))) end
code[F_, l_] := N[(N[(Pi * l), $MachinePrecision] - N[(N[(N[(1.0 / N[(-0.5 * N[Power[N[(Pi * l), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / F), $MachinePrecision] * N[(N[Sin[N[(Pi * l), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot \ell - \frac{\frac{1}{\mathsf{fma}\left(-0.5, {\left(\pi \cdot \ell\right)}^{2}, 1\right)}}{F} \cdot \frac{\sin \left(\pi \cdot \ell\right)}{F}
\end{array}
Initial program 79.5%
sqr-neg79.5%
associate-*l/79.6%
*-lft-identity79.6%
sqr-neg79.6%
Simplified79.6%
tan-quot79.6%
clear-num79.6%
Applied egg-rr79.6%
Taylor expanded in l around 0 83.2%
+-commutative83.2%
fma-def83.2%
*-commutative83.2%
unpow283.2%
unpow283.2%
swap-sqr83.2%
unpow283.2%
*-commutative83.2%
Simplified83.2%
associate-/r/83.2%
times-frac93.3%
*-commutative93.3%
Applied egg-rr93.3%
Final simplification93.3%
(FPCore (F l)
:precision binary64
(if (<= F 1.1e-219)
(- (* PI l) (/ (/ (/ (tan (* PI l)) F) (sqrt F)) (sqrt F)))
(+
(* PI l)
(/
(/
-1.0
(+ (* l (- (* PI -0.5) (* PI -0.16666666666666666))) (/ 1.0 (* PI l))))
(* F F)))))
double code(double F, double l) {
double tmp;
if (F <= 1.1e-219) {
tmp = (((double) M_PI) * l) - (((tan((((double) M_PI) * l)) / F) / sqrt(F)) / sqrt(F));
} else {
tmp = (((double) M_PI) * l) + ((-1.0 / ((l * ((((double) M_PI) * -0.5) - (((double) M_PI) * -0.16666666666666666))) + (1.0 / (((double) M_PI) * l)))) / (F * F));
}
return tmp;
}
public static double code(double F, double l) {
double tmp;
if (F <= 1.1e-219) {
tmp = (Math.PI * l) - (((Math.tan((Math.PI * l)) / F) / Math.sqrt(F)) / Math.sqrt(F));
} else {
tmp = (Math.PI * l) + ((-1.0 / ((l * ((Math.PI * -0.5) - (Math.PI * -0.16666666666666666))) + (1.0 / (Math.PI * l)))) / (F * F));
}
return tmp;
}
def code(F, l): tmp = 0 if F <= 1.1e-219: tmp = (math.pi * l) - (((math.tan((math.pi * l)) / F) / math.sqrt(F)) / math.sqrt(F)) else: tmp = (math.pi * l) + ((-1.0 / ((l * ((math.pi * -0.5) - (math.pi * -0.16666666666666666))) + (1.0 / (math.pi * l)))) / (F * F)) return tmp
function code(F, l) tmp = 0.0 if (F <= 1.1e-219) tmp = Float64(Float64(pi * l) - Float64(Float64(Float64(tan(Float64(pi * l)) / F) / sqrt(F)) / sqrt(F))); else tmp = Float64(Float64(pi * l) + Float64(Float64(-1.0 / Float64(Float64(l * Float64(Float64(pi * -0.5) - Float64(pi * -0.16666666666666666))) + Float64(1.0 / Float64(pi * l)))) / Float64(F * F))); end return tmp end
function tmp_2 = code(F, l) tmp = 0.0; if (F <= 1.1e-219) tmp = (pi * l) - (((tan((pi * l)) / F) / sqrt(F)) / sqrt(F)); else tmp = (pi * l) + ((-1.0 / ((l * ((pi * -0.5) - (pi * -0.16666666666666666))) + (1.0 / (pi * l)))) / (F * F)); end tmp_2 = tmp; end
code[F_, l_] := If[LessEqual[F, 1.1e-219], N[(N[(Pi * l), $MachinePrecision] - N[(N[(N[(N[Tan[N[(Pi * l), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision] / N[Sqrt[F], $MachinePrecision]), $MachinePrecision] / N[Sqrt[F], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] + N[(N[(-1.0 / N[(N[(l * N[(N[(Pi * -0.5), $MachinePrecision] - N[(Pi * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(Pi * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq 1.1 \cdot 10^{-219}:\\
\;\;\;\;\pi \cdot \ell - \frac{\frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{\sqrt{F}}}{\sqrt{F}}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell + \frac{\frac{-1}{\ell \cdot \left(\pi \cdot -0.5 - \pi \cdot -0.16666666666666666\right) + \frac{1}{\pi \cdot \ell}}}{F \cdot F}\\
\end{array}
\end{array}
if F < 1.1e-219Initial program 74.1%
associate-*l/74.1%
*-un-lft-identity74.1%
associate-/r*77.0%
add-sqr-sqrt2.7%
associate-/r*2.7%
Applied egg-rr2.7%
if 1.1e-219 < F Initial program 88.2%
sqr-neg88.2%
associate-*l/88.3%
*-lft-identity88.3%
sqr-neg88.3%
Simplified88.3%
tan-quot88.3%
clear-num88.3%
Applied egg-rr88.3%
Taylor expanded in l around 0 91.0%
+-commutative91.0%
fma-def91.0%
*-commutative91.0%
unpow291.0%
unpow291.0%
swap-sqr91.0%
unpow291.0%
*-commutative91.0%
Simplified91.0%
Taylor expanded in l around 0 90.2%
Final simplification36.2%
(FPCore (F l)
:precision binary64
(if (<= F 1.1e-219)
(- (* PI l) (/ (/ (tan (* PI l)) F) F))
(+
(* PI l)
(/
(/
-1.0
(+ (* l (- (* PI -0.5) (* PI -0.16666666666666666))) (/ 1.0 (* PI l))))
(* F F)))))
double code(double F, double l) {
double tmp;
if (F <= 1.1e-219) {
tmp = (((double) M_PI) * l) - ((tan((((double) M_PI) * l)) / F) / F);
} else {
tmp = (((double) M_PI) * l) + ((-1.0 / ((l * ((((double) M_PI) * -0.5) - (((double) M_PI) * -0.16666666666666666))) + (1.0 / (((double) M_PI) * l)))) / (F * F));
}
return tmp;
}
public static double code(double F, double l) {
double tmp;
if (F <= 1.1e-219) {
tmp = (Math.PI * l) - ((Math.tan((Math.PI * l)) / F) / F);
} else {
tmp = (Math.PI * l) + ((-1.0 / ((l * ((Math.PI * -0.5) - (Math.PI * -0.16666666666666666))) + (1.0 / (Math.PI * l)))) / (F * F));
}
return tmp;
}
def code(F, l): tmp = 0 if F <= 1.1e-219: tmp = (math.pi * l) - ((math.tan((math.pi * l)) / F) / F) else: tmp = (math.pi * l) + ((-1.0 / ((l * ((math.pi * -0.5) - (math.pi * -0.16666666666666666))) + (1.0 / (math.pi * l)))) / (F * F)) return tmp
function code(F, l) tmp = 0.0 if (F <= 1.1e-219) tmp = Float64(Float64(pi * l) - Float64(Float64(tan(Float64(pi * l)) / F) / F)); else tmp = Float64(Float64(pi * l) + Float64(Float64(-1.0 / Float64(Float64(l * Float64(Float64(pi * -0.5) - Float64(pi * -0.16666666666666666))) + Float64(1.0 / Float64(pi * l)))) / Float64(F * F))); end return tmp end
function tmp_2 = code(F, l) tmp = 0.0; if (F <= 1.1e-219) tmp = (pi * l) - ((tan((pi * l)) / F) / F); else tmp = (pi * l) + ((-1.0 / ((l * ((pi * -0.5) - (pi * -0.16666666666666666))) + (1.0 / (pi * l)))) / (F * F)); end tmp_2 = tmp; end
code[F_, l_] := If[LessEqual[F, 1.1e-219], N[(N[(Pi * l), $MachinePrecision] - N[(N[(N[Tan[N[(Pi * l), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] + N[(N[(-1.0 / N[(N[(l * N[(N[(Pi * -0.5), $MachinePrecision] - N[(Pi * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(Pi * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq 1.1 \cdot 10^{-219}:\\
\;\;\;\;\pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell + \frac{\frac{-1}{\ell \cdot \left(\pi \cdot -0.5 - \pi \cdot -0.16666666666666666\right) + \frac{1}{\pi \cdot \ell}}}{F \cdot F}\\
\end{array}
\end{array}
if F < 1.1e-219Initial program 74.1%
associate-*l/74.1%
*-un-lft-identity74.1%
associate-/r*77.0%
Applied egg-rr77.0%
if 1.1e-219 < F Initial program 88.2%
sqr-neg88.2%
associate-*l/88.3%
*-lft-identity88.3%
sqr-neg88.3%
Simplified88.3%
tan-quot88.3%
clear-num88.3%
Applied egg-rr88.3%
Taylor expanded in l around 0 91.0%
+-commutative91.0%
fma-def91.0%
*-commutative91.0%
unpow291.0%
unpow291.0%
swap-sqr91.0%
unpow291.0%
*-commutative91.0%
Simplified91.0%
Taylor expanded in l around 0 90.2%
Final simplification82.1%
(FPCore (F l)
:precision binary64
(if (<= F 1.1e-219)
(- (* PI l) (/ (/ (tan (* PI l)) F) F))
(+
(* PI l)
(/ (/ -1.0 (fma l (* PI -0.3333333333333333) (/ (/ 1.0 l) PI))) (* F F)))))
double code(double F, double l) {
double tmp;
if (F <= 1.1e-219) {
tmp = (((double) M_PI) * l) - ((tan((((double) M_PI) * l)) / F) / F);
} else {
tmp = (((double) M_PI) * l) + ((-1.0 / fma(l, (((double) M_PI) * -0.3333333333333333), ((1.0 / l) / ((double) M_PI)))) / (F * F));
}
return tmp;
}
function code(F, l) tmp = 0.0 if (F <= 1.1e-219) tmp = Float64(Float64(pi * l) - Float64(Float64(tan(Float64(pi * l)) / F) / F)); else tmp = Float64(Float64(pi * l) + Float64(Float64(-1.0 / fma(l, Float64(pi * -0.3333333333333333), Float64(Float64(1.0 / l) / pi))) / Float64(F * F))); end return tmp end
code[F_, l_] := If[LessEqual[F, 1.1e-219], N[(N[(Pi * l), $MachinePrecision] - N[(N[(N[Tan[N[(Pi * l), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] + N[(N[(-1.0 / N[(l * N[(Pi * -0.3333333333333333), $MachinePrecision] + N[(N[(1.0 / l), $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq 1.1 \cdot 10^{-219}:\\
\;\;\;\;\pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell + \frac{\frac{-1}{\mathsf{fma}\left(\ell, \pi \cdot -0.3333333333333333, \frac{\frac{1}{\ell}}{\pi}\right)}}{F \cdot F}\\
\end{array}
\end{array}
if F < 1.1e-219Initial program 74.1%
associate-*l/74.1%
*-un-lft-identity74.1%
associate-/r*77.0%
Applied egg-rr77.0%
if 1.1e-219 < F Initial program 88.2%
sqr-neg88.2%
associate-*l/88.3%
*-lft-identity88.3%
sqr-neg88.3%
Simplified88.3%
tan-quot88.3%
clear-num88.3%
Applied egg-rr88.3%
Taylor expanded in l around 0 91.0%
+-commutative91.0%
fma-def91.0%
*-commutative91.0%
unpow291.0%
unpow291.0%
swap-sqr91.0%
unpow291.0%
*-commutative91.0%
Simplified91.0%
Taylor expanded in l around 0 90.2%
fma-def90.2%
distribute-rgt-out--90.2%
metadata-eval90.2%
associate-/r*90.1%
Simplified90.1%
Final simplification82.0%
(FPCore (F l) :precision binary64 (fma PI l (/ (/ (tan (* PI l)) (- F)) F)))
double code(double F, double l) {
return fma(((double) M_PI), l, ((tan((((double) M_PI) * l)) / -F) / F));
}
function code(F, l) return fma(pi, l, Float64(Float64(tan(Float64(pi * l)) / Float64(-F)) / F)) end
code[F_, l_] := N[(Pi * l + N[(N[(N[Tan[N[(Pi * l), $MachinePrecision]], $MachinePrecision] / (-F)), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\pi, \ell, \frac{\frac{\tan \left(\pi \cdot \ell\right)}{-F}}{F}\right)
\end{array}
Initial program 79.5%
*-commutative79.5%
sqr-neg79.5%
*-commutative79.5%
fma-neg79.5%
associate-*l/79.6%
times-frac81.3%
distribute-lft-neg-in81.3%
neg-mul-181.3%
associate-/r*81.3%
metadata-eval81.3%
distribute-neg-frac81.3%
metadata-eval81.3%
times-frac79.6%
Simplified81.3%
Final simplification81.3%
(FPCore (F l) :precision binary64 (if (<= F 1.1e-219) (- (* PI l) (/ PI (/ F (/ l F)))) (- (* PI l) (/ (tan (* PI l)) (* F F)))))
double code(double F, double l) {
double tmp;
if (F <= 1.1e-219) {
tmp = (((double) M_PI) * l) - (((double) M_PI) / (F / (l / F)));
} 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 (F <= 1.1e-219) {
tmp = (Math.PI * l) - (Math.PI / (F / (l / F)));
} else {
tmp = (Math.PI * l) - (Math.tan((Math.PI * l)) / (F * F));
}
return tmp;
}
def code(F, l): tmp = 0 if F <= 1.1e-219: tmp = (math.pi * l) - (math.pi / (F / (l / F))) else: tmp = (math.pi * l) - (math.tan((math.pi * l)) / (F * F)) return tmp
function code(F, l) tmp = 0.0 if (F <= 1.1e-219) tmp = Float64(Float64(pi * l) - Float64(pi / Float64(F / Float64(l / F)))); else tmp = Float64(Float64(pi * l) - Float64(tan(Float64(pi * l)) / Float64(F * F))); end return tmp end
function tmp_2 = code(F, l) tmp = 0.0; if (F <= 1.1e-219) tmp = (pi * l) - (pi / (F / (l / F))); else tmp = (pi * l) - (tan((pi * l)) / (F * F)); end tmp_2 = tmp; end
code[F_, l_] := If[LessEqual[F, 1.1e-219], N[(N[(Pi * l), $MachinePrecision] - N[(Pi / N[(F / N[(l / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] - N[(N[Tan[N[(Pi * l), $MachinePrecision]], $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq 1.1 \cdot 10^{-219}:\\
\;\;\;\;\pi \cdot \ell - \frac{\pi}{\frac{F}{\frac{\ell}{F}}}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell - \frac{\tan \left(\pi \cdot \ell\right)}{F \cdot F}\\
\end{array}
\end{array}
if F < 1.1e-219Initial program 74.1%
sqr-neg74.1%
associate-*l/74.1%
*-lft-identity74.1%
sqr-neg74.1%
Simplified74.1%
Taylor expanded in l around 0 68.2%
*-commutative68.2%
times-frac71.1%
Applied egg-rr71.1%
associate-*l/71.1%
associate-/l*71.1%
Applied egg-rr71.1%
if 1.1e-219 < F Initial program 88.2%
sqr-neg88.2%
associate-*l/88.3%
*-lft-identity88.3%
sqr-neg88.3%
Simplified88.3%
Final simplification77.7%
(FPCore (F l) :precision binary64 (- (* PI l) (/ (/ (tan (* PI l)) F) F)))
double code(double F, double l) {
return (((double) M_PI) * l) - ((tan((((double) M_PI) * l)) / F) / F);
}
public static double code(double F, double l) {
return (Math.PI * l) - ((Math.tan((Math.PI * l)) / F) / F);
}
def code(F, l): return (math.pi * l) - ((math.tan((math.pi * l)) / F) / F)
function code(F, l) return Float64(Float64(pi * l) - Float64(Float64(tan(Float64(pi * l)) / F) / F)) end
function tmp = code(F, l) tmp = (pi * l) - ((tan((pi * l)) / F) / F); end
code[F_, l_] := N[(N[(Pi * l), $MachinePrecision] - N[(N[(N[Tan[N[(Pi * l), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}
\end{array}
Initial program 79.5%
associate-*l/79.6%
*-un-lft-identity79.6%
associate-/r*81.3%
Applied egg-rr81.3%
Final simplification81.3%
(FPCore (F l) :precision binary64 (fma PI l (/ (/ (* PI l) (- F)) F)))
double code(double F, double l) {
return fma(((double) M_PI), l, (((((double) M_PI) * l) / -F) / F));
}
function code(F, l) return fma(pi, l, Float64(Float64(Float64(pi * l) / Float64(-F)) / F)) end
code[F_, l_] := N[(Pi * l + N[(N[(N[(Pi * l), $MachinePrecision] / (-F)), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\pi, \ell, \frac{\frac{\pi \cdot \ell}{-F}}{F}\right)
\end{array}
Initial program 79.5%
*-commutative79.5%
sqr-neg79.5%
*-commutative79.5%
fma-neg79.5%
associate-*l/79.6%
times-frac81.3%
distribute-lft-neg-in81.3%
neg-mul-181.3%
associate-/r*81.3%
metadata-eval81.3%
distribute-neg-frac81.3%
metadata-eval81.3%
times-frac79.6%
Simplified81.3%
Taylor expanded in l around 0 74.2%
Final simplification74.2%
(FPCore (F l) :precision binary64 (- (* PI l) (* (/ l F) (/ PI F))))
double code(double F, double l) {
return (((double) M_PI) * l) - ((l / F) * (((double) M_PI) / F));
}
public static double code(double F, double l) {
return (Math.PI * l) - ((l / F) * (Math.PI / F));
}
def code(F, l): return (math.pi * l) - ((l / F) * (math.pi / F))
function code(F, l) return Float64(Float64(pi * l) - Float64(Float64(l / F) * Float64(pi / F))) end
function tmp = code(F, l) tmp = (pi * l) - ((l / F) * (pi / F)); end
code[F_, l_] := N[(N[(Pi * l), $MachinePrecision] - N[(N[(l / F), $MachinePrecision] * N[(Pi / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot \ell - \frac{\ell}{F} \cdot \frac{\pi}{F}
\end{array}
Initial program 79.5%
sqr-neg79.5%
associate-*l/79.6%
*-lft-identity79.6%
sqr-neg79.6%
Simplified79.6%
Taylor expanded in l around 0 72.4%
*-commutative72.4%
times-frac74.1%
Applied egg-rr74.1%
Final simplification74.1%
(FPCore (F l) :precision binary64 (- (* PI l) (/ PI (/ F (/ l F)))))
double code(double F, double l) {
return (((double) M_PI) * l) - (((double) M_PI) / (F / (l / F)));
}
public static double code(double F, double l) {
return (Math.PI * l) - (Math.PI / (F / (l / F)));
}
def code(F, l): return (math.pi * l) - (math.pi / (F / (l / F)))
function code(F, l) return Float64(Float64(pi * l) - Float64(pi / Float64(F / Float64(l / F)))) end
function tmp = code(F, l) tmp = (pi * l) - (pi / (F / (l / F))); end
code[F_, l_] := N[(N[(Pi * l), $MachinePrecision] - N[(Pi / N[(F / N[(l / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot \ell - \frac{\pi}{\frac{F}{\frac{\ell}{F}}}
\end{array}
Initial program 79.5%
sqr-neg79.5%
associate-*l/79.6%
*-lft-identity79.6%
sqr-neg79.6%
Simplified79.6%
Taylor expanded in l around 0 72.4%
*-commutative72.4%
times-frac74.1%
Applied egg-rr74.1%
associate-*l/74.2%
associate-/l*74.2%
Applied egg-rr74.2%
Final simplification74.2%
herbie shell --seed 2023305
(FPCore (F l)
:name "VandenBroeck and Keller, Equation (6)"
:precision binary64
(- (* PI l) (* (/ 1.0 (* F F)) (tan (* PI l)))))