
(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
(if (or (<= (* PI l) -1e+43) (not (<= (* PI l) 5e-5)))
(+
(* PI l)
(/ (sin (* PI l)) (* (pow F 2.0) (+ 1.0 (* -0.5 (pow (* PI l) 2.0))))))
(- (* PI l) (/ (/ (tan (* PI l)) F) F))))
double code(double F, double l) {
double tmp;
if (((((double) M_PI) * l) <= -1e+43) || !((((double) M_PI) * l) <= 5e-5)) {
tmp = (((double) M_PI) * l) + (sin((((double) M_PI) * l)) / (pow(F, 2.0) * (1.0 + (-0.5 * pow((((double) M_PI) * l), 2.0)))));
} 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) <= -1e+43) || !((Math.PI * l) <= 5e-5)) {
tmp = (Math.PI * l) + (Math.sin((Math.PI * l)) / (Math.pow(F, 2.0) * (1.0 + (-0.5 * Math.pow((Math.PI * l), 2.0)))));
} else {
tmp = (Math.PI * l) - ((Math.tan((Math.PI * l)) / F) / F);
}
return tmp;
}
def code(F, l): tmp = 0 if ((math.pi * l) <= -1e+43) or not ((math.pi * l) <= 5e-5): tmp = (math.pi * l) + (math.sin((math.pi * l)) / (math.pow(F, 2.0) * (1.0 + (-0.5 * math.pow((math.pi * l), 2.0))))) 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) <= -1e+43) || !(Float64(pi * l) <= 5e-5)) tmp = Float64(Float64(pi * l) + Float64(sin(Float64(pi * l)) / Float64((F ^ 2.0) * Float64(1.0 + Float64(-0.5 * (Float64(pi * l) ^ 2.0)))))); else tmp = Float64(Float64(pi * l) - Float64(Float64(tan(Float64(pi * l)) / F) / F)); end return tmp end
function tmp_2 = code(F, l) tmp = 0.0; if (((pi * l) <= -1e+43) || ~(((pi * l) <= 5e-5))) tmp = (pi * l) + (sin((pi * l)) / ((F ^ 2.0) * (1.0 + (-0.5 * ((pi * l) ^ 2.0))))); else tmp = (pi * l) - ((tan((pi * l)) / F) / F); end tmp_2 = tmp; end
code[F_, l_] := If[Or[LessEqual[N[(Pi * l), $MachinePrecision], -1e+43], N[Not[LessEqual[N[(Pi * l), $MachinePrecision], 5e-5]], $MachinePrecision]], N[(N[(Pi * l), $MachinePrecision] + N[(N[Sin[N[(Pi * l), $MachinePrecision]], $MachinePrecision] / N[(N[Power[F, 2.0], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[Power[N[(Pi * l), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] - 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^{+43} \lor \neg \left(\pi \cdot \ell \leq 5 \cdot 10^{-5}\right):\\
\;\;\;\;\pi \cdot \ell + \frac{\sin \left(\pi \cdot \ell\right)}{{F}^{2} \cdot \left(1 + -0.5 \cdot {\left(\pi \cdot \ell\right)}^{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < -1.00000000000000001e43 or 5.00000000000000024e-5 < (*.f64 (PI.f64) l) Initial program 55.8%
associate-*l/55.8%
*-un-lft-identity55.8%
associate-/r*55.8%
frac-2neg55.8%
distribute-frac-neg55.8%
add-sqr-sqrt27.4%
sqrt-unprod55.8%
sqr-neg55.8%
sqrt-prod28.4%
add-sqr-sqrt56.2%
associate-/l/56.2%
tan-quot56.2%
distribute-neg-frac56.2%
associate-/l/56.2%
pow256.2%
Applied egg-rr56.2%
Taylor expanded in l around 0 71.0%
*-commutative71.0%
unpow271.0%
unpow271.0%
swap-sqr71.0%
unpow271.0%
*-commutative71.0%
Simplified71.0%
if -1.00000000000000001e43 < (*.f64 (PI.f64) l) < 5.00000000000000024e-5Initial program 88.9%
*-commutative88.9%
div-inv89.5%
associate-/r*97.4%
Applied egg-rr97.4%
Final simplification84.7%
(FPCore (F l) :precision binary64 (- (* PI l) (/ (/ (tan (* l (cbrt (pow PI 3.0)))) F) F)))
double code(double F, double l) {
return (((double) M_PI) * l) - ((tan((l * cbrt(pow(((double) M_PI), 3.0)))) / F) / F);
}
public static double code(double F, double l) {
return (Math.PI * l) - ((Math.tan((l * Math.cbrt(Math.pow(Math.PI, 3.0)))) / F) / F);
}
function code(F, l) return Float64(Float64(pi * l) - Float64(Float64(tan(Float64(l * cbrt((pi ^ 3.0)))) / F) / F)) end
code[F_, l_] := N[(N[(Pi * l), $MachinePrecision] - N[(N[(N[Tan[N[(l * N[Power[N[Power[Pi, 3.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot \ell - \frac{\frac{\tan \left(\ell \cdot \sqrt[3]{{\pi}^{3}}\right)}{F}}{F}
\end{array}
Initial program 73.0%
*-commutative73.0%
div-inv73.3%
associate-/r*77.4%
Applied egg-rr77.4%
add-cbrt-cube77.5%
unpow377.5%
Applied egg-rr77.5%
Final simplification77.5%
(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 73.0%
fma-neg73.0%
neg-mul-173.0%
metadata-eval73.0%
associate-*l/73.3%
*-lft-identity73.3%
times-frac73.3%
*-lft-identity73.3%
associate-*l*73.3%
neg-mul-173.3%
associate-/r*77.4%
Simplified77.4%
Final simplification77.4%
(FPCore (F l) :precision binary64 (if (<= (* PI l) -2000000.0) (+ (* PI l) (/ (* l (/ PI F)) F)) (+ (* PI l) (/ (* PI (/ l F)) (- F)))))
double code(double F, double l) {
double tmp;
if ((((double) M_PI) * l) <= -2000000.0) {
tmp = (((double) M_PI) * l) + ((l * (((double) M_PI) / F)) / F);
} else {
tmp = (((double) M_PI) * l) + ((((double) M_PI) * (l / F)) / -F);
}
return tmp;
}
public static double code(double F, double l) {
double tmp;
if ((Math.PI * l) <= -2000000.0) {
tmp = (Math.PI * l) + ((l * (Math.PI / F)) / F);
} else {
tmp = (Math.PI * l) + ((Math.PI * (l / F)) / -F);
}
return tmp;
}
def code(F, l): tmp = 0 if (math.pi * l) <= -2000000.0: tmp = (math.pi * l) + ((l * (math.pi / F)) / F) else: tmp = (math.pi * l) + ((math.pi * (l / F)) / -F) return tmp
function code(F, l) tmp = 0.0 if (Float64(pi * l) <= -2000000.0) tmp = Float64(Float64(pi * l) + Float64(Float64(l * Float64(pi / F)) / F)); else tmp = Float64(Float64(pi * l) + Float64(Float64(pi * Float64(l / F)) / Float64(-F))); end return tmp end
function tmp_2 = code(F, l) tmp = 0.0; if ((pi * l) <= -2000000.0) tmp = (pi * l) + ((l * (pi / F)) / F); else tmp = (pi * l) + ((pi * (l / F)) / -F); end tmp_2 = tmp; end
code[F_, l_] := If[LessEqual[N[(Pi * l), $MachinePrecision], -2000000.0], N[(N[(Pi * l), $MachinePrecision] + N[(N[(l * N[(Pi / F), $MachinePrecision]), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] + N[(N[(Pi * N[(l / F), $MachinePrecision]), $MachinePrecision] / (-F)), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\pi \cdot \ell \leq -2000000:\\
\;\;\;\;\pi \cdot \ell + \frac{\ell \cdot \frac{\pi}{F}}{F}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell + \frac{\pi \cdot \frac{\ell}{F}}{-F}\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < -2e6Initial program 56.6%
*-commutative56.6%
div-inv56.6%
associate-/r*56.6%
Applied egg-rr56.6%
add-cbrt-cube56.8%
unpow356.8%
Applied egg-rr56.8%
rem-cbrt-cube56.6%
tan-quot56.6%
add-sqr-sqrt26.3%
sqrt-unprod53.3%
sqr-neg53.3%
sqrt-unprod27.0%
add-sqr-sqrt52.0%
distribute-neg-frac52.0%
tan-quot52.0%
Applied egg-rr52.0%
Taylor expanded in l around 0 43.9%
mul-1-neg43.9%
associate-*r/43.9%
distribute-rgt-neg-in43.9%
distribute-neg-frac43.9%
Simplified43.9%
if -2e6 < (*.f64 (PI.f64) l) Initial program 78.5%
associate-*l/78.9%
*-lft-identity78.9%
Simplified78.9%
Taylor expanded in l around 0 74.2%
times-frac79.6%
*-commutative79.6%
Applied egg-rr79.6%
*-commutative79.6%
frac-2neg79.6%
associate-*r/79.7%
Applied egg-rr79.7%
Final simplification70.7%
(FPCore (F l) :precision binary64 (if (<= (* F F) 0.0) (- (* PI l) (/ (/ l F) (/ F PI))) (- (* PI l) (/ (tan (* PI l)) (* F F)))))
double code(double F, double l) {
double tmp;
if ((F * F) <= 0.0) {
tmp = (((double) M_PI) * l) - ((l / F) / (F / ((double) M_PI)));
} 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 * F) <= 0.0) {
tmp = (Math.PI * l) - ((l / F) / (F / Math.PI));
} else {
tmp = (Math.PI * l) - (Math.tan((Math.PI * l)) / (F * F));
}
return tmp;
}
def code(F, l): tmp = 0 if (F * F) <= 0.0: tmp = (math.pi * l) - ((l / F) / (F / math.pi)) else: tmp = (math.pi * l) - (math.tan((math.pi * l)) / (F * F)) return tmp
function code(F, l) tmp = 0.0 if (Float64(F * F) <= 0.0) tmp = Float64(Float64(pi * l) - Float64(Float64(l / F) / Float64(F / pi))); 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 * F) <= 0.0) tmp = (pi * l) - ((l / F) / (F / pi)); else tmp = (pi * l) - (tan((pi * l)) / (F * F)); end tmp_2 = tmp; end
code[F_, l_] := If[LessEqual[N[(F * F), $MachinePrecision], 0.0], N[(N[(Pi * l), $MachinePrecision] - N[(N[(l / F), $MachinePrecision] / N[(F / Pi), $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 \cdot F \leq 0:\\
\;\;\;\;\pi \cdot \ell - \frac{\frac{\ell}{F}}{\frac{F}{\pi}}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell - \frac{\tan \left(\pi \cdot \ell\right)}{F \cdot F}\\
\end{array}
\end{array}
if (*.f64 F F) < 0.0Initial program 27.5%
associate-*l/27.5%
*-lft-identity27.5%
Simplified27.5%
Taylor expanded in l around 0 22.8%
times-frac40.0%
*-commutative40.0%
Applied egg-rr40.0%
*-commutative40.0%
clear-num40.1%
un-div-inv40.1%
Applied egg-rr40.1%
if 0.0 < (*.f64 F F) Initial program 86.9%
associate-*l/87.3%
*-lft-identity87.3%
Simplified87.3%
Final simplification76.2%
(FPCore (F l) :precision binary64 (if (<= (* PI l) -2000000.0) (+ (* PI l) (/ (* l (/ PI F)) F)) (- (* PI l) (/ (/ PI (/ F l)) F))))
double code(double F, double l) {
double tmp;
if ((((double) M_PI) * l) <= -2000000.0) {
tmp = (((double) M_PI) * l) + ((l * (((double) M_PI) / F)) / F);
} else {
tmp = (((double) M_PI) * l) - ((((double) M_PI) / (F / l)) / F);
}
return tmp;
}
public static double code(double F, double l) {
double tmp;
if ((Math.PI * l) <= -2000000.0) {
tmp = (Math.PI * l) + ((l * (Math.PI / F)) / F);
} else {
tmp = (Math.PI * l) - ((Math.PI / (F / l)) / F);
}
return tmp;
}
def code(F, l): tmp = 0 if (math.pi * l) <= -2000000.0: tmp = (math.pi * l) + ((l * (math.pi / F)) / F) else: tmp = (math.pi * l) - ((math.pi / (F / l)) / F) return tmp
function code(F, l) tmp = 0.0 if (Float64(pi * l) <= -2000000.0) tmp = Float64(Float64(pi * l) + Float64(Float64(l * Float64(pi / F)) / F)); else tmp = Float64(Float64(pi * l) - Float64(Float64(pi / Float64(F / l)) / F)); end return tmp end
function tmp_2 = code(F, l) tmp = 0.0; if ((pi * l) <= -2000000.0) tmp = (pi * l) + ((l * (pi / F)) / F); else tmp = (pi * l) - ((pi / (F / l)) / F); end tmp_2 = tmp; end
code[F_, l_] := If[LessEqual[N[(Pi * l), $MachinePrecision], -2000000.0], N[(N[(Pi * l), $MachinePrecision] + N[(N[(l * N[(Pi / F), $MachinePrecision]), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] - N[(N[(Pi / N[(F / l), $MachinePrecision]), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\pi \cdot \ell \leq -2000000:\\
\;\;\;\;\pi \cdot \ell + \frac{\ell \cdot \frac{\pi}{F}}{F}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell - \frac{\frac{\pi}{\frac{F}{\ell}}}{F}\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < -2e6Initial program 56.6%
*-commutative56.6%
div-inv56.6%
associate-/r*56.6%
Applied egg-rr56.6%
add-cbrt-cube56.8%
unpow356.8%
Applied egg-rr56.8%
rem-cbrt-cube56.6%
tan-quot56.6%
add-sqr-sqrt26.3%
sqrt-unprod53.3%
sqr-neg53.3%
sqrt-unprod27.0%
add-sqr-sqrt52.0%
distribute-neg-frac52.0%
tan-quot52.0%
Applied egg-rr52.0%
Taylor expanded in l around 0 43.9%
mul-1-neg43.9%
associate-*r/43.9%
distribute-rgt-neg-in43.9%
distribute-neg-frac43.9%
Simplified43.9%
if -2e6 < (*.f64 (PI.f64) l) Initial program 78.5%
*-commutative78.5%
div-inv78.9%
associate-/r*84.4%
Applied egg-rr84.4%
Taylor expanded in l around 0 79.6%
*-commutative79.6%
associate-/l*79.7%
Simplified79.7%
Final simplification70.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 73.0%
*-commutative73.0%
div-inv73.3%
associate-/r*77.4%
Applied egg-rr77.4%
Final simplification77.4%
(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 73.0%
associate-*l/73.3%
*-lft-identity73.3%
Simplified73.3%
Taylor expanded in l around 0 64.6%
times-frac68.7%
*-commutative68.7%
Applied egg-rr68.7%
Final simplification68.7%
(FPCore (F l) :precision binary64 (- (* PI l) (* PI (/ (/ l F) F))))
double code(double F, double l) {
return (((double) M_PI) * l) - (((double) M_PI) * ((l / F) / F));
}
public static double code(double F, double l) {
return (Math.PI * l) - (Math.PI * ((l / F) / F));
}
def code(F, l): return (math.pi * l) - (math.pi * ((l / F) / F))
function code(F, l) return Float64(Float64(pi * l) - Float64(pi * Float64(Float64(l / F) / F))) end
function tmp = code(F, l) tmp = (pi * l) - (pi * ((l / F) / F)); end
code[F_, l_] := N[(N[(Pi * l), $MachinePrecision] - N[(Pi * N[(N[(l / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot \ell - \pi \cdot \frac{\frac{\ell}{F}}{F}
\end{array}
Initial program 73.0%
associate-*l/73.3%
*-lft-identity73.3%
Simplified73.3%
Taylor expanded in l around 0 64.6%
times-frac68.7%
*-commutative68.7%
Applied egg-rr68.7%
clear-num68.7%
metadata-eval68.7%
frac-times64.6%
metadata-eval64.6%
*-un-lft-identity64.6%
Applied egg-rr64.6%
associate-/l/68.7%
associate-/r/68.7%
Applied egg-rr68.7%
Final simplification68.7%
(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 / Float64(F / 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 / N[(F / l), $MachinePrecision]), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot \ell - \frac{\frac{\pi}{\frac{F}{\ell}}}{F}
\end{array}
Initial program 73.0%
*-commutative73.0%
div-inv73.3%
associate-/r*77.4%
Applied egg-rr77.4%
Taylor expanded in l around 0 68.7%
*-commutative68.7%
associate-/l*68.7%
Simplified68.7%
Final simplification68.7%
herbie shell --seed 2023301
(FPCore (F l)
:name "VandenBroeck and Keller, Equation (6)"
:precision binary64
(- (* PI l) (* (/ 1.0 (* F F)) (tan (* PI l)))))