
(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)
(/
(/
(/
-1.0
(/
(+
1.0
(*
(pow l 2.0)
(+
(* -0.5 (pow PI 2.0))
(*
(pow l 2.0)
(+
(* -0.001388888888888889 (* (pow l 2.0) (pow PI 6.0)))
(* 0.041666666666666664 (pow PI 4.0)))))))
(sin (* PI l))))
F)
F)))
double code(double F, double l) {
return (((double) M_PI) * l) + (((-1.0 / ((1.0 + (pow(l, 2.0) * ((-0.5 * pow(((double) M_PI), 2.0)) + (pow(l, 2.0) * ((-0.001388888888888889 * (pow(l, 2.0) * pow(((double) M_PI), 6.0))) + (0.041666666666666664 * pow(((double) M_PI), 4.0))))))) / sin((((double) M_PI) * l)))) / F) / F);
}
public static double code(double F, double l) {
return (Math.PI * l) + (((-1.0 / ((1.0 + (Math.pow(l, 2.0) * ((-0.5 * Math.pow(Math.PI, 2.0)) + (Math.pow(l, 2.0) * ((-0.001388888888888889 * (Math.pow(l, 2.0) * Math.pow(Math.PI, 6.0))) + (0.041666666666666664 * Math.pow(Math.PI, 4.0))))))) / Math.sin((Math.PI * l)))) / F) / F);
}
def code(F, l): return (math.pi * l) + (((-1.0 / ((1.0 + (math.pow(l, 2.0) * ((-0.5 * math.pow(math.pi, 2.0)) + (math.pow(l, 2.0) * ((-0.001388888888888889 * (math.pow(l, 2.0) * math.pow(math.pi, 6.0))) + (0.041666666666666664 * math.pow(math.pi, 4.0))))))) / math.sin((math.pi * l)))) / F) / F)
function code(F, l) return Float64(Float64(pi * l) + Float64(Float64(Float64(-1.0 / Float64(Float64(1.0 + Float64((l ^ 2.0) * Float64(Float64(-0.5 * (pi ^ 2.0)) + Float64((l ^ 2.0) * Float64(Float64(-0.001388888888888889 * Float64((l ^ 2.0) * (pi ^ 6.0))) + Float64(0.041666666666666664 * (pi ^ 4.0))))))) / sin(Float64(pi * l)))) / F) / F)) end
function tmp = code(F, l) tmp = (pi * l) + (((-1.0 / ((1.0 + ((l ^ 2.0) * ((-0.5 * (pi ^ 2.0)) + ((l ^ 2.0) * ((-0.001388888888888889 * ((l ^ 2.0) * (pi ^ 6.0))) + (0.041666666666666664 * (pi ^ 4.0))))))) / sin((pi * l)))) / F) / F); end
code[F_, l_] := N[(N[(Pi * l), $MachinePrecision] + N[(N[(N[(-1.0 / N[(N[(1.0 + N[(N[Power[l, 2.0], $MachinePrecision] * N[(N[(-0.5 * N[Power[Pi, 2.0], $MachinePrecision]), $MachinePrecision] + N[(N[Power[l, 2.0], $MachinePrecision] * N[(N[(-0.001388888888888889 * N[(N[Power[l, 2.0], $MachinePrecision] * N[Power[Pi, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.041666666666666664 * N[Power[Pi, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[N[(Pi * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot \ell + \frac{\frac{\frac{-1}{\frac{1 + {\ell}^{2} \cdot \left(-0.5 \cdot {\pi}^{2} + {\ell}^{2} \cdot \left(-0.001388888888888889 \cdot \left({\ell}^{2} \cdot {\pi}^{6}\right) + 0.041666666666666664 \cdot {\pi}^{4}\right)\right)}{\sin \left(\pi \cdot \ell\right)}}}{F}}{F}
\end{array}
Initial program 76.4%
associate-*l/76.7%
*-un-lft-identity76.7%
associate-/r*81.5%
Applied egg-rr81.5%
tan-quot81.5%
clear-num81.5%
Applied egg-rr81.5%
Taylor expanded in l around 0 95.7%
Final simplification95.7%
(FPCore (F l)
:precision binary64
(+
(* PI l)
(/
(/
(/
-1.0
(/
(+
1.0
(*
(pow l 2.0)
(+
(* -0.5 (pow PI 2.0))
(* 0.041666666666666664 (* (pow l 2.0) (pow PI 4.0))))))
(sin (* PI l))))
F)
F)))
double code(double F, double l) {
return (((double) M_PI) * l) + (((-1.0 / ((1.0 + (pow(l, 2.0) * ((-0.5 * pow(((double) M_PI), 2.0)) + (0.041666666666666664 * (pow(l, 2.0) * pow(((double) M_PI), 4.0)))))) / sin((((double) M_PI) * l)))) / F) / F);
}
public static double code(double F, double l) {
return (Math.PI * l) + (((-1.0 / ((1.0 + (Math.pow(l, 2.0) * ((-0.5 * Math.pow(Math.PI, 2.0)) + (0.041666666666666664 * (Math.pow(l, 2.0) * Math.pow(Math.PI, 4.0)))))) / Math.sin((Math.PI * l)))) / F) / F);
}
def code(F, l): return (math.pi * l) + (((-1.0 / ((1.0 + (math.pow(l, 2.0) * ((-0.5 * math.pow(math.pi, 2.0)) + (0.041666666666666664 * (math.pow(l, 2.0) * math.pow(math.pi, 4.0)))))) / math.sin((math.pi * l)))) / F) / F)
function code(F, l) return Float64(Float64(pi * l) + Float64(Float64(Float64(-1.0 / Float64(Float64(1.0 + Float64((l ^ 2.0) * Float64(Float64(-0.5 * (pi ^ 2.0)) + Float64(0.041666666666666664 * Float64((l ^ 2.0) * (pi ^ 4.0)))))) / sin(Float64(pi * l)))) / F) / F)) end
function tmp = code(F, l) tmp = (pi * l) + (((-1.0 / ((1.0 + ((l ^ 2.0) * ((-0.5 * (pi ^ 2.0)) + (0.041666666666666664 * ((l ^ 2.0) * (pi ^ 4.0)))))) / sin((pi * l)))) / F) / F); end
code[F_, l_] := N[(N[(Pi * l), $MachinePrecision] + N[(N[(N[(-1.0 / N[(N[(1.0 + N[(N[Power[l, 2.0], $MachinePrecision] * N[(N[(-0.5 * N[Power[Pi, 2.0], $MachinePrecision]), $MachinePrecision] + N[(0.041666666666666664 * N[(N[Power[l, 2.0], $MachinePrecision] * N[Power[Pi, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[N[(Pi * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot \ell + \frac{\frac{\frac{-1}{\frac{1 + {\ell}^{2} \cdot \left(-0.5 \cdot {\pi}^{2} + 0.041666666666666664 \cdot \left({\ell}^{2} \cdot {\pi}^{4}\right)\right)}{\sin \left(\pi \cdot \ell\right)}}}{F}}{F}
\end{array}
Initial program 76.4%
associate-*l/76.7%
*-un-lft-identity76.7%
associate-/r*81.5%
Applied egg-rr81.5%
tan-quot81.5%
clear-num81.5%
Applied egg-rr81.5%
Taylor expanded in l around 0 95.4%
Final simplification95.4%
(FPCore (F l)
:precision binary64
(+
(* PI l)
(/
(/ -1.0 F)
(*
F
(/
(fma
(pow l 2.0)
(-
(* PI 0.16666666666666666)
(* (pow l 2.0) (* (pow PI 3.0) -0.019444444444444445)))
(/ 1.0 PI))
l)))))
double code(double F, double l) {
return (((double) M_PI) * l) + ((-1.0 / F) / (F * (fma(pow(l, 2.0), ((((double) M_PI) * 0.16666666666666666) - (pow(l, 2.0) * (pow(((double) M_PI), 3.0) * -0.019444444444444445))), (1.0 / ((double) M_PI))) / l)));
}
function code(F, l) return Float64(Float64(pi * l) + Float64(Float64(-1.0 / F) / Float64(F * Float64(fma((l ^ 2.0), Float64(Float64(pi * 0.16666666666666666) - Float64((l ^ 2.0) * Float64((pi ^ 3.0) * -0.019444444444444445))), Float64(1.0 / pi)) / l)))) end
code[F_, l_] := N[(N[(Pi * l), $MachinePrecision] + N[(N[(-1.0 / F), $MachinePrecision] / N[(F * N[(N[(N[Power[l, 2.0], $MachinePrecision] * N[(N[(Pi * 0.16666666666666666), $MachinePrecision] - N[(N[Power[l, 2.0], $MachinePrecision] * N[(N[Power[Pi, 3.0], $MachinePrecision] * -0.019444444444444445), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / Pi), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot \ell + \frac{\frac{-1}{F}}{F \cdot \frac{\mathsf{fma}\left({\ell}^{2}, \pi \cdot 0.16666666666666666 - {\ell}^{2} \cdot \left({\pi}^{3} \cdot -0.019444444444444445\right), \frac{1}{\pi}\right)}{\ell}}
\end{array}
Initial program 76.4%
tan-quot76.4%
Applied egg-rr76.4%
Taylor expanded in l around 0 75.6%
/-rgt-identity75.6%
*-commutative75.6%
/-rgt-identity75.6%
clear-num75.6%
associate-/r*75.5%
metadata-eval75.5%
add-sqr-sqrt36.8%
sqrt-prod64.6%
sqrt-div64.6%
frac-times64.6%
*-un-lft-identity64.6%
sqrt-div64.9%
metadata-eval64.9%
sqrt-prod39.7%
add-sqr-sqrt80.6%
Applied egg-rr80.6%
Taylor expanded in l around 0 95.0%
fma-define95.0%
cancel-sign-sub-inv95.0%
mul-1-neg95.0%
distribute-rgt-out95.0%
metadata-eval95.0%
metadata-eval95.0%
Simplified95.0%
Final simplification95.0%
(FPCore (F l)
:precision binary64
(if (<= (* F F) 1e-308)
(+
(* PI l)
(/
(/ -1.0 F)
(* F (/ (+ (/ 1.0 PI) (* 0.16666666666666666 (* PI (pow l 2.0)))) l))))
(+
(* PI l)
(*
(/ (sin (* PI l)) (fma -0.5 (pow (* PI l) 2.0) 1.0))
(/ -1.0 (* F F))))))
double code(double F, double l) {
double tmp;
if ((F * F) <= 1e-308) {
tmp = (((double) M_PI) * l) + ((-1.0 / F) / (F * (((1.0 / ((double) M_PI)) + (0.16666666666666666 * (((double) M_PI) * pow(l, 2.0)))) / l)));
} else {
tmp = (((double) M_PI) * l) + ((sin((((double) M_PI) * l)) / fma(-0.5, pow((((double) M_PI) * l), 2.0), 1.0)) * (-1.0 / (F * F)));
}
return tmp;
}
function code(F, l) tmp = 0.0 if (Float64(F * F) <= 1e-308) tmp = Float64(Float64(pi * l) + Float64(Float64(-1.0 / F) / Float64(F * Float64(Float64(Float64(1.0 / pi) + Float64(0.16666666666666666 * Float64(pi * (l ^ 2.0)))) / l)))); else tmp = Float64(Float64(pi * l) + Float64(Float64(sin(Float64(pi * l)) / fma(-0.5, (Float64(pi * l) ^ 2.0), 1.0)) * Float64(-1.0 / Float64(F * F)))); end return tmp end
code[F_, l_] := If[LessEqual[N[(F * F), $MachinePrecision], 1e-308], N[(N[(Pi * l), $MachinePrecision] + N[(N[(-1.0 / F), $MachinePrecision] / N[(F * N[(N[(N[(1.0 / Pi), $MachinePrecision] + N[(0.16666666666666666 * N[(Pi * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] + N[(N[(N[Sin[N[(Pi * l), $MachinePrecision]], $MachinePrecision] / N[(-0.5 * N[Power[N[(Pi * l), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \cdot F \leq 10^{-308}:\\
\;\;\;\;\pi \cdot \ell + \frac{\frac{-1}{F}}{F \cdot \frac{\frac{1}{\pi} + 0.16666666666666666 \cdot \left(\pi \cdot {\ell}^{2}\right)}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell + \frac{\sin \left(\pi \cdot \ell\right)}{\mathsf{fma}\left(-0.5, {\left(\pi \cdot \ell\right)}^{2}, 1\right)} \cdot \frac{-1}{F \cdot F}\\
\end{array}
\end{array}
if (*.f64 F F) < 9.9999999999999991e-309Initial program 37.3%
tan-quot37.3%
Applied egg-rr37.3%
Taylor expanded in l around 0 35.7%
/-rgt-identity35.7%
*-commutative35.7%
/-rgt-identity35.7%
clear-num35.7%
associate-/r*35.7%
metadata-eval35.7%
add-sqr-sqrt16.9%
sqrt-prod17.9%
sqrt-div17.9%
frac-times18.0%
*-un-lft-identity18.0%
sqrt-div19.2%
metadata-eval19.2%
sqrt-prod27.8%
add-sqr-sqrt54.5%
Applied egg-rr54.5%
Taylor expanded in l around 0 72.4%
if 9.9999999999999991e-309 < (*.f64 F F) Initial program 90.8%
tan-quot90.8%
Applied egg-rr90.8%
Taylor expanded in l around 0 97.9%
+-commutative97.9%
fma-define97.9%
*-commutative97.9%
unpow297.9%
unpow297.9%
swap-sqr97.9%
unpow297.9%
*-commutative97.9%
Simplified97.9%
Final simplification91.0%
(FPCore (F l) :precision binary64 (+ (* PI l) (/ (/ (/ -1.0 (/ (fma -0.5 (pow (* PI l) 2.0) 1.0) (sin (* PI l)))) F) 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) / sin((((double) M_PI) * l)))) / F) / F);
}
function code(F, l) return Float64(Float64(pi * l) + Float64(Float64(Float64(-1.0 / Float64(fma(-0.5, (Float64(pi * l) ^ 2.0), 1.0) / sin(Float64(pi * l)))) / F) / F)) end
code[F_, l_] := N[(N[(Pi * l), $MachinePrecision] + N[(N[(N[(-1.0 / N[(N[(-0.5 * N[Power[N[(Pi * l), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision] / N[Sin[N[(Pi * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot \ell + \frac{\frac{\frac{-1}{\frac{\mathsf{fma}\left(-0.5, {\left(\pi \cdot \ell\right)}^{2}, 1\right)}{\sin \left(\pi \cdot \ell\right)}}}{F}}{F}
\end{array}
Initial program 76.4%
associate-*l/76.7%
*-un-lft-identity76.7%
associate-/r*81.5%
Applied egg-rr81.5%
tan-quot81.5%
clear-num81.5%
Applied egg-rr81.5%
Taylor expanded in l around 0 91.9%
+-commutative91.9%
fma-define91.9%
*-commutative91.9%
unpow291.9%
unpow291.9%
swap-sqr91.9%
unpow291.9%
*-commutative91.9%
Simplified91.9%
Final simplification91.9%
(FPCore (F l) :precision binary64 (+ (* PI l) (/ (/ -1.0 F) (* F (/ (+ (/ 1.0 PI) (* 0.16666666666666666 (* PI (pow l 2.0)))) l)))))
double code(double F, double l) {
return (((double) M_PI) * l) + ((-1.0 / F) / (F * (((1.0 / ((double) M_PI)) + (0.16666666666666666 * (((double) M_PI) * pow(l, 2.0)))) / l)));
}
public static double code(double F, double l) {
return (Math.PI * l) + ((-1.0 / F) / (F * (((1.0 / Math.PI) + (0.16666666666666666 * (Math.PI * Math.pow(l, 2.0)))) / l)));
}
def code(F, l): return (math.pi * l) + ((-1.0 / F) / (F * (((1.0 / math.pi) + (0.16666666666666666 * (math.pi * math.pow(l, 2.0)))) / l)))
function code(F, l) return Float64(Float64(pi * l) + Float64(Float64(-1.0 / F) / Float64(F * Float64(Float64(Float64(1.0 / pi) + Float64(0.16666666666666666 * Float64(pi * (l ^ 2.0)))) / l)))) end
function tmp = code(F, l) tmp = (pi * l) + ((-1.0 / F) / (F * (((1.0 / pi) + (0.16666666666666666 * (pi * (l ^ 2.0)))) / l))); end
code[F_, l_] := N[(N[(Pi * l), $MachinePrecision] + N[(N[(-1.0 / F), $MachinePrecision] / N[(F * N[(N[(N[(1.0 / Pi), $MachinePrecision] + N[(0.16666666666666666 * N[(Pi * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot \ell + \frac{\frac{-1}{F}}{F \cdot \frac{\frac{1}{\pi} + 0.16666666666666666 \cdot \left(\pi \cdot {\ell}^{2}\right)}{\ell}}
\end{array}
Initial program 76.4%
tan-quot76.4%
Applied egg-rr76.4%
Taylor expanded in l around 0 75.6%
/-rgt-identity75.6%
*-commutative75.6%
/-rgt-identity75.6%
clear-num75.6%
associate-/r*75.5%
metadata-eval75.5%
add-sqr-sqrt36.8%
sqrt-prod64.6%
sqrt-div64.6%
frac-times64.6%
*-un-lft-identity64.6%
sqrt-div64.9%
metadata-eval64.9%
sqrt-prod39.7%
add-sqr-sqrt80.6%
Applied egg-rr80.6%
Taylor expanded in l around 0 88.2%
Final simplification88.2%
(FPCore (F l) :precision binary64 (if (<= (* PI l) 2e-77) (- (* PI l) (/ (/ PI F) (/ F l))) (- (* PI l) (/ (tan (* PI l)) (* F F)))))
double code(double F, double l) {
double tmp;
if ((((double) M_PI) * l) <= 2e-77) {
tmp = (((double) M_PI) * l) - ((((double) M_PI) / F) / (F / l));
} 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 ((Math.PI * l) <= 2e-77) {
tmp = (Math.PI * l) - ((Math.PI / F) / (F / l));
} else {
tmp = (Math.PI * l) - (Math.tan((Math.PI * l)) / (F * F));
}
return tmp;
}
def code(F, l): tmp = 0 if (math.pi * l) <= 2e-77: tmp = (math.pi * l) - ((math.pi / F) / (F / l)) else: tmp = (math.pi * l) - (math.tan((math.pi * l)) / (F * F)) return tmp
function code(F, l) tmp = 0.0 if (Float64(pi * l) <= 2e-77) tmp = Float64(Float64(pi * l) - Float64(Float64(pi / F) / Float64(F / l))); 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 ((pi * l) <= 2e-77) tmp = (pi * l) - ((pi / F) / (F / l)); else tmp = (pi * l) - (tan((pi * l)) / (F * F)); end tmp_2 = tmp; end
code[F_, l_] := If[LessEqual[N[(Pi * l), $MachinePrecision], 2e-77], N[(N[(Pi * l), $MachinePrecision] - N[(N[(Pi / F), $MachinePrecision] / N[(F / l), $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}\;\pi \cdot \ell \leq 2 \cdot 10^{-77}:\\
\;\;\;\;\pi \cdot \ell - \frac{\frac{\pi}{F}}{\frac{F}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell - \frac{\tan \left(\pi \cdot \ell\right)}{F \cdot F}\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 1.9999999999999999e-77Initial program 79.8%
*-commutative79.8%
sqr-neg79.8%
associate-*r/80.2%
sqr-neg80.2%
*-rgt-identity80.2%
Simplified80.2%
Taylor expanded in l around 0 76.9%
*-commutative76.9%
times-frac83.5%
Applied egg-rr83.5%
clear-num83.5%
un-div-inv83.6%
Applied egg-rr83.6%
if 1.9999999999999999e-77 < (*.f64 (PI.f64) l) Initial program 67.4%
*-commutative67.4%
sqr-neg67.4%
associate-*r/67.4%
sqr-neg67.4%
*-rgt-identity67.4%
Simplified67.4%
(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 76.4%
associate-*l/76.7%
*-un-lft-identity76.7%
associate-/r*81.5%
Applied egg-rr81.5%
(FPCore (F l) :precision binary64 (- (* PI l) (/ (/ (sin (* PI l)) F) F)))
double code(double F, double l) {
return (((double) M_PI) * l) - ((sin((((double) M_PI) * l)) / F) / F);
}
public static double code(double F, double l) {
return (Math.PI * l) - ((Math.sin((Math.PI * l)) / F) / F);
}
def code(F, l): return (math.pi * l) - ((math.sin((math.pi * l)) / F) / F)
function code(F, l) return Float64(Float64(pi * l) - Float64(Float64(sin(Float64(pi * l)) / F) / F)) end
function tmp = code(F, l) tmp = (pi * l) - ((sin((pi * l)) / F) / F); end
code[F_, l_] := N[(N[(Pi * l), $MachinePrecision] - N[(N[(N[Sin[N[(Pi * l), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot \ell - \frac{\frac{\sin \left(\pi \cdot \ell\right)}{F}}{F}
\end{array}
Initial program 76.4%
tan-quot76.4%
Applied egg-rr76.4%
Taylor expanded in l around 0 75.6%
/-rgt-identity75.6%
associate-*l/75.9%
*-un-lft-identity75.9%
associate-/r*80.7%
Applied egg-rr80.7%
(FPCore (F l) :precision binary64 (- (* PI l) (/ (/ PI F) (/ F l))))
double code(double F, double l) {
return (((double) M_PI) * l) - ((((double) M_PI) / F) / (F / l));
}
public static double code(double F, double l) {
return (Math.PI * l) - ((Math.PI / F) / (F / l));
}
def code(F, l): return (math.pi * l) - ((math.pi / F) / (F / l))
function code(F, l) return Float64(Float64(pi * l) - Float64(Float64(pi / F) / Float64(F / l))) end
function tmp = code(F, l) tmp = (pi * l) - ((pi / F) / (F / l)); end
code[F_, l_] := N[(N[(Pi * l), $MachinePrecision] - N[(N[(Pi / F), $MachinePrecision] / N[(F / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot \ell - \frac{\frac{\pi}{F}}{\frac{F}{\ell}}
\end{array}
Initial program 76.4%
*-commutative76.4%
sqr-neg76.4%
associate-*r/76.7%
sqr-neg76.7%
*-rgt-identity76.7%
Simplified76.7%
Taylor expanded in l around 0 72.5%
*-commutative72.5%
times-frac77.3%
Applied egg-rr77.3%
clear-num77.3%
un-div-inv77.3%
Applied egg-rr77.3%
(FPCore (F l) :precision binary64 (- (* PI l) (/ (* l (/ PI F)) F)))
double code(double F, double l) {
return (((double) M_PI) * l) - ((l * (((double) M_PI) / F)) / F);
}
public static double code(double F, double l) {
return (Math.PI * l) - ((l * (Math.PI / F)) / F);
}
def code(F, l): return (math.pi * l) - ((l * (math.pi / F)) / F)
function code(F, l) return Float64(Float64(pi * l) - Float64(Float64(l * Float64(pi / F)) / F)) end
function tmp = code(F, l) tmp = (pi * l) - ((l * (pi / F)) / F); end
code[F_, l_] := N[(N[(Pi * l), $MachinePrecision] - N[(N[(l * N[(Pi / F), $MachinePrecision]), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot \ell - \frac{\ell \cdot \frac{\pi}{F}}{F}
\end{array}
Initial program 76.4%
associate-*l/76.7%
*-un-lft-identity76.7%
associate-/r*81.5%
Applied egg-rr81.5%
Taylor expanded in l around 0 77.3%
associate-/l*77.3%
Simplified77.3%
(FPCore (F l) :precision binary64 (- (* PI l) (/ PI (* F (/ F l)))))
double code(double F, double l) {
return (((double) M_PI) * l) - (((double) M_PI) / (F * (F / l)));
}
public static double code(double F, double l) {
return (Math.PI * l) - (Math.PI / (F * (F / l)));
}
def code(F, l): return (math.pi * l) - (math.pi / (F * (F / l)))
function code(F, l) return Float64(Float64(pi * l) - Float64(pi / Float64(F * Float64(F / l)))) end
function tmp = code(F, l) tmp = (pi * l) - (pi / (F * (F / l))); end
code[F_, l_] := N[(N[(Pi * l), $MachinePrecision] - N[(Pi / N[(F * N[(F / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot \ell - \frac{\pi}{F \cdot \frac{F}{\ell}}
\end{array}
Initial program 76.4%
*-commutative76.4%
sqr-neg76.4%
associate-*r/76.7%
sqr-neg76.7%
*-rgt-identity76.7%
Simplified76.7%
Taylor expanded in l around 0 72.5%
*-commutative72.5%
times-frac77.3%
Applied egg-rr77.3%
*-commutative77.3%
clear-num77.3%
frac-times77.3%
*-un-lft-identity77.3%
Applied egg-rr77.3%
Final simplification77.3%
(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(Float64(pi / 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[(N[(Pi / F), $MachinePrecision] * N[(l / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot \ell - \frac{\pi}{F} \cdot \frac{\ell}{F}
\end{array}
Initial program 76.4%
*-commutative76.4%
sqr-neg76.4%
associate-*r/76.7%
sqr-neg76.7%
*-rgt-identity76.7%
Simplified76.7%
Taylor expanded in l around 0 72.5%
*-commutative72.5%
times-frac77.3%
Applied egg-rr77.3%
herbie shell --seed 2024101
(FPCore (F l)
:name "VandenBroeck and Keller, Equation (6)"
:precision binary64
(- (* PI l) (* (/ 1.0 (* F F)) (tan (* PI l)))))