
(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 10 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 F)
(+
(-
(/ F (* PI l))
(* F (/ (* (* l (pow PI 3.0)) 0.3333333333333333) (pow PI 2.0))))
(*
(pow l 3.0)
(*
F
(-
(* (pow PI 3.0) -0.013888888888888888)
(* (pow PI 3.0) 0.008333333333333333))))))))
double code(double F, double l) {
return (((double) M_PI) * l) + ((-1.0 / F) / (((F / (((double) M_PI) * l)) - (F * (((l * pow(((double) M_PI), 3.0)) * 0.3333333333333333) / pow(((double) M_PI), 2.0)))) + (pow(l, 3.0) * (F * ((pow(((double) M_PI), 3.0) * -0.013888888888888888) - (pow(((double) M_PI), 3.0) * 0.008333333333333333))))));
}
public static double code(double F, double l) {
return (Math.PI * l) + ((-1.0 / F) / (((F / (Math.PI * l)) - (F * (((l * Math.pow(Math.PI, 3.0)) * 0.3333333333333333) / Math.pow(Math.PI, 2.0)))) + (Math.pow(l, 3.0) * (F * ((Math.pow(Math.PI, 3.0) * -0.013888888888888888) - (Math.pow(Math.PI, 3.0) * 0.008333333333333333))))));
}
def code(F, l): return (math.pi * l) + ((-1.0 / F) / (((F / (math.pi * l)) - (F * (((l * math.pow(math.pi, 3.0)) * 0.3333333333333333) / math.pow(math.pi, 2.0)))) + (math.pow(l, 3.0) * (F * ((math.pow(math.pi, 3.0) * -0.013888888888888888) - (math.pow(math.pi, 3.0) * 0.008333333333333333))))))
function code(F, l) return Float64(Float64(pi * l) + Float64(Float64(-1.0 / F) / Float64(Float64(Float64(F / Float64(pi * l)) - Float64(F * Float64(Float64(Float64(l * (pi ^ 3.0)) * 0.3333333333333333) / (pi ^ 2.0)))) + Float64((l ^ 3.0) * Float64(F * Float64(Float64((pi ^ 3.0) * -0.013888888888888888) - Float64((pi ^ 3.0) * 0.008333333333333333))))))) end
function tmp = code(F, l) tmp = (pi * l) + ((-1.0 / F) / (((F / (pi * l)) - (F * (((l * (pi ^ 3.0)) * 0.3333333333333333) / (pi ^ 2.0)))) + ((l ^ 3.0) * (F * (((pi ^ 3.0) * -0.013888888888888888) - ((pi ^ 3.0) * 0.008333333333333333)))))); end
code[F_, l_] := N[(N[(Pi * l), $MachinePrecision] + N[(N[(-1.0 / F), $MachinePrecision] / N[(N[(N[(F / N[(Pi * l), $MachinePrecision]), $MachinePrecision] - N[(F * N[(N[(N[(l * N[Power[Pi, 3.0], $MachinePrecision]), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] / N[Power[Pi, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[l, 3.0], $MachinePrecision] * N[(F * N[(N[(N[Power[Pi, 3.0], $MachinePrecision] * -0.013888888888888888), $MachinePrecision] - N[(N[Power[Pi, 3.0], $MachinePrecision] * 0.008333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot \ell + \frac{\frac{-1}{F}}{\left(\frac{F}{\pi \cdot \ell} - F \cdot \frac{\left(\ell \cdot {\pi}^{3}\right) \cdot 0.3333333333333333}{{\pi}^{2}}\right) + {\ell}^{3} \cdot \left(F \cdot \left({\pi}^{3} \cdot -0.013888888888888888 - {\pi}^{3} \cdot 0.008333333333333333\right)\right)}
\end{array}
Initial program 78.4%
associate-/r/78.8%
associate-/l*82.8%
clear-num82.8%
add-sqr-sqrt38.3%
sqrt-prod68.3%
sqr-neg68.3%
sqrt-unprod30.4%
div-inv30.4%
metadata-eval30.4%
add-sqr-sqrt0.0%
sqrt-prod40.9%
sqrt-div40.9%
add-sqr-sqrt67.4%
associate-*l/67.4%
clear-num67.4%
associate-*l/67.5%
*-un-lft-identity67.5%
Applied egg-rr82.8%
Taylor expanded in l around 0 94.7%
Simplified94.7%
Taylor expanded in F around 0 94.7%
*-commutative94.7%
distribute-rgt-out94.7%
distribute-lft-out94.7%
metadata-eval94.7%
metadata-eval94.7%
Simplified94.7%
Final simplification94.7%
(FPCore (F l)
:precision binary64
(if (or (<= (* PI l) -1e+162) (not (<= (* PI l) -5e+14)))
(+
(* PI l)
(/
(/ -1.0 F)
(-
(/ F (* PI l))
(* F (/ (* (* l (pow PI 3.0)) 0.3333333333333333) (pow PI 2.0))))))
(-
(* PI l)
(expm1
(fma l (/ PI (pow F 2.0)) (/ -0.5 (/ (pow F 4.0) (pow (* PI l) 2.0))))))))
double code(double F, double l) {
double tmp;
if (((((double) M_PI) * l) <= -1e+162) || !((((double) M_PI) * l) <= -5e+14)) {
tmp = (((double) M_PI) * l) + ((-1.0 / F) / ((F / (((double) M_PI) * l)) - (F * (((l * pow(((double) M_PI), 3.0)) * 0.3333333333333333) / pow(((double) M_PI), 2.0)))));
} else {
tmp = (((double) M_PI) * l) - expm1(fma(l, (((double) M_PI) / pow(F, 2.0)), (-0.5 / (pow(F, 4.0) / pow((((double) M_PI) * l), 2.0)))));
}
return tmp;
}
function code(F, l) tmp = 0.0 if ((Float64(pi * l) <= -1e+162) || !(Float64(pi * l) <= -5e+14)) tmp = Float64(Float64(pi * l) + Float64(Float64(-1.0 / F) / Float64(Float64(F / Float64(pi * l)) - Float64(F * Float64(Float64(Float64(l * (pi ^ 3.0)) * 0.3333333333333333) / (pi ^ 2.0)))))); else tmp = Float64(Float64(pi * l) - expm1(fma(l, Float64(pi / (F ^ 2.0)), Float64(-0.5 / Float64((F ^ 4.0) / (Float64(pi * l) ^ 2.0)))))); end return tmp end
code[F_, l_] := If[Or[LessEqual[N[(Pi * l), $MachinePrecision], -1e+162], N[Not[LessEqual[N[(Pi * l), $MachinePrecision], -5e+14]], $MachinePrecision]], N[(N[(Pi * l), $MachinePrecision] + N[(N[(-1.0 / F), $MachinePrecision] / N[(N[(F / N[(Pi * l), $MachinePrecision]), $MachinePrecision] - N[(F * N[(N[(N[(l * N[Power[Pi, 3.0], $MachinePrecision]), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] / N[Power[Pi, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] - N[(Exp[N[(l * N[(Pi / N[Power[F, 2.0], $MachinePrecision]), $MachinePrecision] + N[(-0.5 / N[(N[Power[F, 4.0], $MachinePrecision] / N[Power[N[(Pi * l), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\pi \cdot \ell \leq -1 \cdot 10^{+162} \lor \neg \left(\pi \cdot \ell \leq -5 \cdot 10^{+14}\right):\\
\;\;\;\;\pi \cdot \ell + \frac{\frac{-1}{F}}{\frac{F}{\pi \cdot \ell} - F \cdot \frac{\left(\ell \cdot {\pi}^{3}\right) \cdot 0.3333333333333333}{{\pi}^{2}}}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell - \mathsf{expm1}\left(\mathsf{fma}\left(\ell, \frac{\pi}{{F}^{2}}, \frac{-0.5}{\frac{{F}^{4}}{{\left(\pi \cdot \ell\right)}^{2}}}\right)\right)\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < -9.9999999999999994e161 or -5e14 < (*.f64 (PI.f64) l) Initial program 81.4%
associate-/r/81.8%
associate-/l*86.5%
clear-num86.5%
add-sqr-sqrt38.5%
sqrt-prod70.2%
sqr-neg70.2%
sqrt-unprod32.1%
div-inv32.1%
metadata-eval32.1%
add-sqr-sqrt0.0%
sqrt-prod43.8%
sqrt-div43.8%
add-sqr-sqrt68.8%
associate-*l/68.9%
clear-num68.8%
associate-*l/68.9%
*-un-lft-identity68.9%
Applied egg-rr86.4%
Taylor expanded in l around 0 92.1%
+-commutative92.1%
mul-1-neg92.1%
unsub-neg92.1%
*-lft-identity92.1%
times-frac92.1%
rem-square-sqrt41.9%
associate-*l/41.9%
/-rgt-identity41.9%
rem-square-sqrt92.1%
Simplified92.1%
if -9.9999999999999994e161 < (*.f64 (PI.f64) l) < -5e14Initial program 58.1%
associate-/r/58.1%
associate-/l*58.1%
clear-num58.1%
frac-2neg58.1%
add-sqr-sqrt21.3%
sqrt-unprod58.0%
sqr-neg58.0%
sqrt-prod36.7%
add-sqr-sqrt55.6%
distribute-neg-frac55.6%
associate-/r*55.6%
expm1-log1p-u46.5%
associate-/r*46.5%
distribute-neg-frac46.5%
add-sqr-sqrt30.5%
sqrt-prod45.7%
sqr-neg45.7%
sqrt-unprod15.1%
add-sqr-sqrt51.9%
frac-2neg51.9%
Applied egg-rr51.9%
Taylor expanded in l around 0 96.3%
+-commutative96.3%
associate-*r/96.3%
fma-def96.3%
associate-*r/96.3%
*-commutative96.3%
unpow296.3%
unpow296.3%
swap-sqr96.3%
unpow296.3%
associate-/l*96.3%
*-commutative96.3%
Simplified96.3%
Final simplification92.6%
(FPCore (F l)
:precision binary64
(+
(* PI l)
(/
(/ -1.0 F)
(-
(/ F (* PI l))
(* F (/ (* (* l (pow PI 3.0)) 0.3333333333333333) (pow PI 2.0)))))))
double code(double F, double l) {
return (((double) M_PI) * l) + ((-1.0 / F) / ((F / (((double) M_PI) * l)) - (F * (((l * pow(((double) M_PI), 3.0)) * 0.3333333333333333) / pow(((double) M_PI), 2.0)))));
}
public static double code(double F, double l) {
return (Math.PI * l) + ((-1.0 / F) / ((F / (Math.PI * l)) - (F * (((l * Math.pow(Math.PI, 3.0)) * 0.3333333333333333) / Math.pow(Math.PI, 2.0)))));
}
def code(F, l): return (math.pi * l) + ((-1.0 / F) / ((F / (math.pi * l)) - (F * (((l * math.pow(math.pi, 3.0)) * 0.3333333333333333) / math.pow(math.pi, 2.0)))))
function code(F, l) return Float64(Float64(pi * l) + Float64(Float64(-1.0 / F) / Float64(Float64(F / Float64(pi * l)) - Float64(F * Float64(Float64(Float64(l * (pi ^ 3.0)) * 0.3333333333333333) / (pi ^ 2.0)))))) end
function tmp = code(F, l) tmp = (pi * l) + ((-1.0 / F) / ((F / (pi * l)) - (F * (((l * (pi ^ 3.0)) * 0.3333333333333333) / (pi ^ 2.0))))); end
code[F_, l_] := N[(N[(Pi * l), $MachinePrecision] + N[(N[(-1.0 / F), $MachinePrecision] / N[(N[(F / N[(Pi * l), $MachinePrecision]), $MachinePrecision] - N[(F * N[(N[(N[(l * N[Power[Pi, 3.0], $MachinePrecision]), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] / N[Power[Pi, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot \ell + \frac{\frac{-1}{F}}{\frac{F}{\pi \cdot \ell} - F \cdot \frac{\left(\ell \cdot {\pi}^{3}\right) \cdot 0.3333333333333333}{{\pi}^{2}}}
\end{array}
Initial program 78.4%
associate-/r/78.8%
associate-/l*82.8%
clear-num82.8%
add-sqr-sqrt38.3%
sqrt-prod68.3%
sqr-neg68.3%
sqrt-unprod30.4%
div-inv30.4%
metadata-eval30.4%
add-sqr-sqrt0.0%
sqrt-prod40.9%
sqrt-div40.9%
add-sqr-sqrt67.4%
associate-*l/67.4%
clear-num67.4%
associate-*l/67.5%
*-un-lft-identity67.5%
Applied egg-rr82.8%
Taylor expanded in l around 0 88.9%
+-commutative88.9%
mul-1-neg88.9%
unsub-neg88.9%
*-lft-identity88.9%
times-frac88.9%
rem-square-sqrt42.3%
associate-*l/42.3%
/-rgt-identity42.3%
rem-square-sqrt88.9%
Simplified88.9%
Final simplification88.9%
(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 78.4%
*-commutative78.4%
sqr-neg78.4%
*-commutative78.4%
fma-neg78.4%
associate-*l/78.8%
times-frac82.8%
distribute-lft-neg-in82.8%
neg-mul-182.8%
associate-/r*82.8%
metadata-eval82.8%
distribute-neg-frac82.8%
metadata-eval82.8%
times-frac78.8%
Simplified82.8%
Final simplification82.8%
(FPCore (F l) :precision binary64 (if (<= F 4.2e-182) (- (* PI l) (/ (/ l (/ F PI)) F)) (- (* PI l) (/ (tan (* PI l)) (* F F)))))
double code(double F, double l) {
double tmp;
if (F <= 4.2e-182) {
tmp = (((double) M_PI) * l) - ((l / (F / ((double) M_PI))) / 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 <= 4.2e-182) {
tmp = (Math.PI * l) - ((l / (F / Math.PI)) / F);
} else {
tmp = (Math.PI * l) - (Math.tan((Math.PI * l)) / (F * F));
}
return tmp;
}
def code(F, l): tmp = 0 if F <= 4.2e-182: tmp = (math.pi * l) - ((l / (F / math.pi)) / F) else: tmp = (math.pi * l) - (math.tan((math.pi * l)) / (F * F)) return tmp
function code(F, l) tmp = 0.0 if (F <= 4.2e-182) tmp = Float64(Float64(pi * l) - Float64(Float64(l / Float64(F / pi)) / 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 <= 4.2e-182) tmp = (pi * l) - ((l / (F / pi)) / F); else tmp = (pi * l) - (tan((pi * l)) / (F * F)); end tmp_2 = tmp; end
code[F_, l_] := If[LessEqual[F, 4.2e-182], N[(N[(Pi * l), $MachinePrecision] - N[(N[(l / N[(F / Pi), $MachinePrecision]), $MachinePrecision] / F), $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 4.2 \cdot 10^{-182}:\\
\;\;\;\;\pi \cdot \ell - \frac{\frac{\ell}{\frac{F}{\pi}}}{F}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell - \frac{\tan \left(\pi \cdot \ell\right)}{F \cdot F}\\
\end{array}
\end{array}
if F < 4.2000000000000001e-182Initial program 73.5%
associate-*l/73.5%
*-un-lft-identity73.5%
associate-/r*79.4%
Applied egg-rr79.4%
Taylor expanded in l around 0 73.2%
associate-/l*73.3%
Simplified73.3%
if 4.2000000000000001e-182 < F Initial program 86.4%
sqr-neg86.4%
associate-*l/87.3%
*-lft-identity87.3%
sqr-neg87.3%
Simplified87.3%
Final simplification78.6%
(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 78.4%
associate-*l/78.8%
*-un-lft-identity78.8%
associate-/r*82.8%
Applied egg-rr82.8%
Final simplification82.8%
(FPCore (F l) :precision binary64 (fma PI l (/ (/ (- l) (/ F PI)) F)))
double code(double F, double l) {
return fma(((double) M_PI), l, ((-l / (F / ((double) M_PI))) / F));
}
function code(F, l) return fma(pi, l, Float64(Float64(Float64(-l) / Float64(F / pi)) / F)) end
code[F_, l_] := N[(Pi * l + N[(N[((-l) / N[(F / Pi), $MachinePrecision]), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\pi, \ell, \frac{\frac{-\ell}{\frac{F}{\pi}}}{F}\right)
\end{array}
Initial program 78.4%
*-commutative78.4%
sqr-neg78.4%
*-commutative78.4%
fma-neg78.4%
associate-*l/78.8%
times-frac82.8%
distribute-lft-neg-in82.8%
neg-mul-182.8%
associate-/r*82.8%
metadata-eval82.8%
distribute-neg-frac82.8%
metadata-eval82.8%
times-frac78.8%
Simplified82.8%
Taylor expanded in l around 0 75.2%
mul-1-neg75.2%
associate-/l*75.2%
Simplified75.2%
Final simplification75.2%
(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 78.4%
sqr-neg78.4%
associate-*l/78.8%
*-lft-identity78.8%
sqr-neg78.8%
Simplified78.8%
Taylor expanded in l around 0 71.1%
*-commutative71.1%
times-frac75.2%
Applied egg-rr75.2%
Final simplification75.2%
(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 78.4%
sqr-neg78.4%
associate-*l/78.8%
*-lft-identity78.8%
sqr-neg78.8%
Simplified78.8%
Taylor expanded in l around 0 71.1%
*-commutative71.1%
times-frac75.2%
Applied egg-rr75.2%
*-commutative75.2%
clear-num75.2%
frac-times75.2%
*-un-lft-identity75.2%
Applied egg-rr75.2%
Final simplification75.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 / Float64(F / 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 / N[(F / Pi), $MachinePrecision]), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot \ell - \frac{\frac{\ell}{\frac{F}{\pi}}}{F}
\end{array}
Initial program 78.4%
associate-*l/78.8%
*-un-lft-identity78.8%
associate-/r*82.8%
Applied egg-rr82.8%
Taylor expanded in l around 0 75.1%
associate-/l*75.2%
Simplified75.2%
Final simplification75.2%
herbie shell --seed 2023311
(FPCore (F l)
:name "VandenBroeck and Keller, Equation (6)"
:precision binary64
(- (* PI l) (* (/ 1.0 (* F F)) (tan (* PI l)))))