
(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 8 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) -5e+17) (not (<= (* PI l) 5e-5))) (* PI l) (- (* PI l) (/ (/ (tan (* PI l)) F) F))))
double code(double F, double l) {
double tmp;
if (((((double) M_PI) * l) <= -5e+17) || !((((double) M_PI) * l) <= 5e-5)) {
tmp = ((double) M_PI) * 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) <= -5e+17) || !((Math.PI * l) <= 5e-5)) {
tmp = Math.PI * 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) <= -5e+17) or not ((math.pi * l) <= 5e-5): tmp = math.pi * 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) <= -5e+17) || !(Float64(pi * l) <= 5e-5)) tmp = Float64(pi * l); 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) <= -5e+17) || ~(((pi * l) <= 5e-5))) tmp = pi * l; else tmp = (pi * l) - ((tan((pi * l)) / F) / F); end tmp_2 = tmp; end
code[F_, l_] := If[Or[LessEqual[N[(Pi * l), $MachinePrecision], -5e+17], N[Not[LessEqual[N[(Pi * l), $MachinePrecision], 5e-5]], $MachinePrecision]], N[(Pi * l), $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 -5 \cdot 10^{+17} \lor \neg \left(\pi \cdot \ell \leq 5 \cdot 10^{-5}\right):\\
\;\;\;\;\pi \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < -5e17 or 5.00000000000000024e-5 < (*.f64 (PI.f64) l) Initial program 54.9%
sqr-neg54.9%
associate-*l/54.9%
*-lft-identity54.9%
sqr-neg54.9%
Simplified54.9%
Taylor expanded in l around 0 40.0%
Taylor expanded in F around inf 99.7%
if -5e17 < (*.f64 (PI.f64) l) < 5.00000000000000024e-5Initial program 90.8%
associate-*l/91.4%
*-un-lft-identity91.4%
associate-/r*99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (F l)
:precision binary64
(if (or (<= (* PI l) -5e-15)
(not
(or (<= (* PI l) -2e-167)
(and (not (<= (* PI l) -2e-202))
(or (<= (* PI l) -1e-288)
(and (not (<= (* PI l) 1e-235))
(<= (* PI l) 5e-45)))))))
(* PI l)
(/ (* PI (/ l F)) (- F))))
double code(double F, double l) {
double tmp;
if (((((double) M_PI) * l) <= -5e-15) || !(((((double) M_PI) * l) <= -2e-167) || (!((((double) M_PI) * l) <= -2e-202) && (((((double) M_PI) * l) <= -1e-288) || (!((((double) M_PI) * l) <= 1e-235) && ((((double) M_PI) * l) <= 5e-45)))))) {
tmp = ((double) M_PI) * l;
} else {
tmp = (((double) M_PI) * (l / F)) / -F;
}
return tmp;
}
public static double code(double F, double l) {
double tmp;
if (((Math.PI * l) <= -5e-15) || !(((Math.PI * l) <= -2e-167) || (!((Math.PI * l) <= -2e-202) && (((Math.PI * l) <= -1e-288) || (!((Math.PI * l) <= 1e-235) && ((Math.PI * l) <= 5e-45)))))) {
tmp = Math.PI * l;
} else {
tmp = (Math.PI * (l / F)) / -F;
}
return tmp;
}
def code(F, l): tmp = 0 if ((math.pi * l) <= -5e-15) or not (((math.pi * l) <= -2e-167) or (not ((math.pi * l) <= -2e-202) and (((math.pi * l) <= -1e-288) or (not ((math.pi * l) <= 1e-235) and ((math.pi * l) <= 5e-45))))): tmp = math.pi * l else: tmp = (math.pi * (l / F)) / -F return tmp
function code(F, l) tmp = 0.0 if ((Float64(pi * l) <= -5e-15) || !((Float64(pi * l) <= -2e-167) || (!(Float64(pi * l) <= -2e-202) && ((Float64(pi * l) <= -1e-288) || (!(Float64(pi * l) <= 1e-235) && (Float64(pi * l) <= 5e-45)))))) tmp = Float64(pi * l); else tmp = Float64(Float64(pi * Float64(l / F)) / Float64(-F)); end return tmp end
function tmp_2 = code(F, l) tmp = 0.0; if (((pi * l) <= -5e-15) || ~((((pi * l) <= -2e-167) || (~(((pi * l) <= -2e-202)) && (((pi * l) <= -1e-288) || (~(((pi * l) <= 1e-235)) && ((pi * l) <= 5e-45))))))) tmp = pi * l; else tmp = (pi * (l / F)) / -F; end tmp_2 = tmp; end
code[F_, l_] := If[Or[LessEqual[N[(Pi * l), $MachinePrecision], -5e-15], N[Not[Or[LessEqual[N[(Pi * l), $MachinePrecision], -2e-167], And[N[Not[LessEqual[N[(Pi * l), $MachinePrecision], -2e-202]], $MachinePrecision], Or[LessEqual[N[(Pi * l), $MachinePrecision], -1e-288], And[N[Not[LessEqual[N[(Pi * l), $MachinePrecision], 1e-235]], $MachinePrecision], LessEqual[N[(Pi * l), $MachinePrecision], 5e-45]]]]]], $MachinePrecision]], N[(Pi * l), $MachinePrecision], N[(N[(Pi * N[(l / F), $MachinePrecision]), $MachinePrecision] / (-F)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\pi \cdot \ell \leq -5 \cdot 10^{-15} \lor \neg \left(\pi \cdot \ell \leq -2 \cdot 10^{-167} \lor \neg \left(\pi \cdot \ell \leq -2 \cdot 10^{-202}\right) \land \left(\pi \cdot \ell \leq -1 \cdot 10^{-288} \lor \neg \left(\pi \cdot \ell \leq 10^{-235}\right) \land \pi \cdot \ell \leq 5 \cdot 10^{-45}\right)\right):\\
\;\;\;\;\pi \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;\frac{\pi \cdot \frac{\ell}{F}}{-F}\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < -4.99999999999999999e-15 or -2e-167 < (*.f64 (PI.f64) l) < -2.0000000000000001e-202 or -1.00000000000000006e-288 < (*.f64 (PI.f64) l) < 9.9999999999999996e-236 or 4.99999999999999976e-45 < (*.f64 (PI.f64) l) Initial program 65.1%
sqr-neg65.1%
associate-*l/65.1%
*-lft-identity65.1%
sqr-neg65.1%
Simplified65.1%
Taylor expanded in l around 0 52.2%
Taylor expanded in F around inf 91.2%
if -4.99999999999999999e-15 < (*.f64 (PI.f64) l) < -2e-167 or -2.0000000000000001e-202 < (*.f64 (PI.f64) l) < -1.00000000000000006e-288 or 9.9999999999999996e-236 < (*.f64 (PI.f64) l) < 4.99999999999999976e-45Initial program 89.4%
sqr-neg89.4%
associate-*l/90.3%
*-lft-identity90.3%
sqr-neg90.3%
Simplified90.3%
Taylor expanded in l around 0 90.3%
Taylor expanded in F around 0 53.7%
mul-1-neg53.7%
associate-*r/52.8%
distribute-rgt-neg-in52.8%
distribute-frac-neg52.8%
Simplified52.8%
associate-*r/53.7%
unpow253.7%
times-frac63.0%
add-sqr-sqrt0.0%
sqrt-unprod2.6%
sqr-neg2.6%
sqrt-unprod2.6%
add-sqr-sqrt2.6%
times-frac2.6%
associate-/l/2.6%
frac-2neg2.6%
Applied egg-rr63.1%
Final simplification82.1%
(FPCore (F l) :precision binary64 (if (or (<= (* PI l) -2000000.0) (not (<= (* PI l) 5e-5))) (* PI l) (+ (* PI l) (/ (* PI (/ l F)) (- F)))))
double code(double F, double l) {
double tmp;
if (((((double) M_PI) * l) <= -2000000.0) || !((((double) M_PI) * l) <= 5e-5)) {
tmp = ((double) M_PI) * l;
} 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) || !((Math.PI * l) <= 5e-5)) {
tmp = Math.PI * l;
} else {
tmp = (Math.PI * l) + ((Math.PI * (l / F)) / -F);
}
return tmp;
}
def code(F, l): tmp = 0 if ((math.pi * l) <= -2000000.0) or not ((math.pi * l) <= 5e-5): tmp = math.pi * l 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) || !(Float64(pi * l) <= 5e-5)) tmp = Float64(pi * l); 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) || ~(((pi * l) <= 5e-5))) tmp = pi * l; else tmp = (pi * l) + ((pi * (l / F)) / -F); end tmp_2 = tmp; end
code[F_, l_] := If[Or[LessEqual[N[(Pi * l), $MachinePrecision], -2000000.0], N[Not[LessEqual[N[(Pi * l), $MachinePrecision], 5e-5]], $MachinePrecision]], N[(Pi * l), $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 \lor \neg \left(\pi \cdot \ell \leq 5 \cdot 10^{-5}\right):\\
\;\;\;\;\pi \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell + \frac{\pi \cdot \frac{\ell}{F}}{-F}\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < -2e6 or 5.00000000000000024e-5 < (*.f64 (PI.f64) l) Initial program 56.3%
sqr-neg56.3%
associate-*l/56.3%
*-lft-identity56.3%
sqr-neg56.3%
Simplified56.3%
Taylor expanded in l around 0 39.5%
Taylor expanded in F around inf 97.5%
if -2e6 < (*.f64 (PI.f64) l) < 5.00000000000000024e-5Initial program 90.5%
sqr-neg90.5%
associate-*l/91.1%
*-lft-identity91.1%
sqr-neg91.1%
Simplified91.1%
Taylor expanded in l around 0 90.9%
*-commutative90.9%
times-frac99.3%
Applied egg-rr99.3%
*-commutative99.3%
frac-2neg99.3%
associate-*r/99.3%
Applied egg-rr99.3%
Final simplification98.4%
(FPCore (F l) :precision binary64 (if (or (<= (* PI l) -2000000.0) (not (<= (* PI l) 5e-5))) (* PI l) (- (* PI l) (* (/ l F) (/ PI F)))))
double code(double F, double l) {
double tmp;
if (((((double) M_PI) * l) <= -2000000.0) || !((((double) M_PI) * l) <= 5e-5)) {
tmp = ((double) M_PI) * l;
} else {
tmp = (((double) M_PI) * l) - ((l / F) * (((double) M_PI) / F));
}
return tmp;
}
public static double code(double F, double l) {
double tmp;
if (((Math.PI * l) <= -2000000.0) || !((Math.PI * l) <= 5e-5)) {
tmp = Math.PI * l;
} else {
tmp = (Math.PI * l) - ((l / F) * (Math.PI / F));
}
return tmp;
}
def code(F, l): tmp = 0 if ((math.pi * l) <= -2000000.0) or not ((math.pi * l) <= 5e-5): tmp = math.pi * l else: tmp = (math.pi * l) - ((l / F) * (math.pi / F)) return tmp
function code(F, l) tmp = 0.0 if ((Float64(pi * l) <= -2000000.0) || !(Float64(pi * l) <= 5e-5)) tmp = Float64(pi * l); else tmp = Float64(Float64(pi * l) - Float64(Float64(l / F) * Float64(pi / F))); end return tmp end
function tmp_2 = code(F, l) tmp = 0.0; if (((pi * l) <= -2000000.0) || ~(((pi * l) <= 5e-5))) tmp = pi * l; else tmp = (pi * l) - ((l / F) * (pi / F)); end tmp_2 = tmp; end
code[F_, l_] := If[Or[LessEqual[N[(Pi * l), $MachinePrecision], -2000000.0], N[Not[LessEqual[N[(Pi * l), $MachinePrecision], 5e-5]], $MachinePrecision]], N[(Pi * l), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] - N[(N[(l / F), $MachinePrecision] * N[(Pi / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\pi \cdot \ell \leq -2000000 \lor \neg \left(\pi \cdot \ell \leq 5 \cdot 10^{-5}\right):\\
\;\;\;\;\pi \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell - \frac{\ell}{F} \cdot \frac{\pi}{F}\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < -2e6 or 5.00000000000000024e-5 < (*.f64 (PI.f64) l) Initial program 56.3%
sqr-neg56.3%
associate-*l/56.3%
*-lft-identity56.3%
sqr-neg56.3%
Simplified56.3%
Taylor expanded in l around 0 39.5%
Taylor expanded in F around inf 97.5%
if -2e6 < (*.f64 (PI.f64) l) < 5.00000000000000024e-5Initial program 90.5%
sqr-neg90.5%
associate-*l/91.1%
*-lft-identity91.1%
sqr-neg91.1%
Simplified91.1%
Taylor expanded in l around 0 90.9%
*-commutative90.9%
times-frac99.3%
Applied egg-rr99.3%
Final simplification98.4%
(FPCore (F l) :precision binary64 (if (or (<= (* PI l) -2000000.0) (not (<= (* PI l) 5e-5))) (* PI l) (- (* PI l) (/ (/ l F) (/ F PI)))))
double code(double F, double l) {
double tmp;
if (((((double) M_PI) * l) <= -2000000.0) || !((((double) M_PI) * l) <= 5e-5)) {
tmp = ((double) M_PI) * l;
} else {
tmp = (((double) M_PI) * l) - ((l / F) / (F / ((double) M_PI)));
}
return tmp;
}
public static double code(double F, double l) {
double tmp;
if (((Math.PI * l) <= -2000000.0) || !((Math.PI * l) <= 5e-5)) {
tmp = Math.PI * l;
} else {
tmp = (Math.PI * l) - ((l / F) / (F / Math.PI));
}
return tmp;
}
def code(F, l): tmp = 0 if ((math.pi * l) <= -2000000.0) or not ((math.pi * l) <= 5e-5): tmp = math.pi * l else: tmp = (math.pi * l) - ((l / F) / (F / math.pi)) return tmp
function code(F, l) tmp = 0.0 if ((Float64(pi * l) <= -2000000.0) || !(Float64(pi * l) <= 5e-5)) tmp = Float64(pi * l); else tmp = Float64(Float64(pi * l) - Float64(Float64(l / F) / Float64(F / pi))); end return tmp end
function tmp_2 = code(F, l) tmp = 0.0; if (((pi * l) <= -2000000.0) || ~(((pi * l) <= 5e-5))) tmp = pi * l; else tmp = (pi * l) - ((l / F) / (F / pi)); end tmp_2 = tmp; end
code[F_, l_] := If[Or[LessEqual[N[(Pi * l), $MachinePrecision], -2000000.0], N[Not[LessEqual[N[(Pi * l), $MachinePrecision], 5e-5]], $MachinePrecision]], N[(Pi * l), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] - N[(N[(l / F), $MachinePrecision] / N[(F / Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\pi \cdot \ell \leq -2000000 \lor \neg \left(\pi \cdot \ell \leq 5 \cdot 10^{-5}\right):\\
\;\;\;\;\pi \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell - \frac{\frac{\ell}{F}}{\frac{F}{\pi}}\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < -2e6 or 5.00000000000000024e-5 < (*.f64 (PI.f64) l) Initial program 56.3%
sqr-neg56.3%
associate-*l/56.3%
*-lft-identity56.3%
sqr-neg56.3%
Simplified56.3%
Taylor expanded in l around 0 39.5%
Taylor expanded in F around inf 97.5%
if -2e6 < (*.f64 (PI.f64) l) < 5.00000000000000024e-5Initial program 90.5%
sqr-neg90.5%
associate-*l/91.1%
*-lft-identity91.1%
sqr-neg91.1%
Simplified91.1%
Taylor expanded in l around 0 90.9%
*-commutative90.9%
times-frac99.3%
Applied egg-rr99.3%
*-commutative99.3%
clear-num99.3%
un-div-inv99.3%
Applied egg-rr99.3%
Final simplification98.4%
(FPCore (F l) :precision binary64 (if (or (<= (* PI l) -2000000.0) (not (<= (* PI l) 5e-5))) (* PI l) (- (* PI l) (/ (/ l (/ F PI)) F))))
double code(double F, double l) {
double tmp;
if (((((double) M_PI) * l) <= -2000000.0) || !((((double) M_PI) * l) <= 5e-5)) {
tmp = ((double) M_PI) * l;
} else {
tmp = (((double) M_PI) * l) - ((l / (F / ((double) M_PI))) / F);
}
return tmp;
}
public static double code(double F, double l) {
double tmp;
if (((Math.PI * l) <= -2000000.0) || !((Math.PI * l) <= 5e-5)) {
tmp = Math.PI * l;
} else {
tmp = (Math.PI * l) - ((l / (F / Math.PI)) / F);
}
return tmp;
}
def code(F, l): tmp = 0 if ((math.pi * l) <= -2000000.0) or not ((math.pi * l) <= 5e-5): tmp = math.pi * l else: tmp = (math.pi * l) - ((l / (F / math.pi)) / F) return tmp
function code(F, l) tmp = 0.0 if ((Float64(pi * l) <= -2000000.0) || !(Float64(pi * l) <= 5e-5)) tmp = Float64(pi * l); else tmp = Float64(Float64(pi * l) - Float64(Float64(l / Float64(F / pi)) / F)); end return tmp end
function tmp_2 = code(F, l) tmp = 0.0; if (((pi * l) <= -2000000.0) || ~(((pi * l) <= 5e-5))) tmp = pi * l; else tmp = (pi * l) - ((l / (F / pi)) / F); end tmp_2 = tmp; end
code[F_, l_] := If[Or[LessEqual[N[(Pi * l), $MachinePrecision], -2000000.0], N[Not[LessEqual[N[(Pi * l), $MachinePrecision], 5e-5]], $MachinePrecision]], N[(Pi * l), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] - N[(N[(l / N[(F / Pi), $MachinePrecision]), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\pi \cdot \ell \leq -2000000 \lor \neg \left(\pi \cdot \ell \leq 5 \cdot 10^{-5}\right):\\
\;\;\;\;\pi \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell - \frac{\frac{\ell}{\frac{F}{\pi}}}{F}\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < -2e6 or 5.00000000000000024e-5 < (*.f64 (PI.f64) l) Initial program 56.3%
sqr-neg56.3%
associate-*l/56.3%
*-lft-identity56.3%
sqr-neg56.3%
Simplified56.3%
Taylor expanded in l around 0 39.5%
Taylor expanded in F around inf 97.5%
if -2e6 < (*.f64 (PI.f64) l) < 5.00000000000000024e-5Initial program 90.5%
associate-*l/91.1%
*-un-lft-identity91.1%
associate-/r*99.5%
Applied egg-rr99.5%
Taylor expanded in l around 0 99.3%
associate-/l*99.3%
Simplified99.3%
Final simplification98.4%
(FPCore (F l) :precision binary64 (if (or (<= (* PI l) -2000000.0) (not (<= (* PI l) 5e-5))) (* PI l) (* PI (- l (/ l (pow F 2.0))))))
double code(double F, double l) {
double tmp;
if (((((double) M_PI) * l) <= -2000000.0) || !((((double) M_PI) * l) <= 5e-5)) {
tmp = ((double) M_PI) * l;
} else {
tmp = ((double) M_PI) * (l - (l / pow(F, 2.0)));
}
return tmp;
}
public static double code(double F, double l) {
double tmp;
if (((Math.PI * l) <= -2000000.0) || !((Math.PI * l) <= 5e-5)) {
tmp = Math.PI * l;
} else {
tmp = Math.PI * (l - (l / Math.pow(F, 2.0)));
}
return tmp;
}
def code(F, l): tmp = 0 if ((math.pi * l) <= -2000000.0) or not ((math.pi * l) <= 5e-5): tmp = math.pi * l else: tmp = math.pi * (l - (l / math.pow(F, 2.0))) return tmp
function code(F, l) tmp = 0.0 if ((Float64(pi * l) <= -2000000.0) || !(Float64(pi * l) <= 5e-5)) tmp = Float64(pi * l); else tmp = Float64(pi * Float64(l - Float64(l / (F ^ 2.0)))); end return tmp end
function tmp_2 = code(F, l) tmp = 0.0; if (((pi * l) <= -2000000.0) || ~(((pi * l) <= 5e-5))) tmp = pi * l; else tmp = pi * (l - (l / (F ^ 2.0))); end tmp_2 = tmp; end
code[F_, l_] := If[Or[LessEqual[N[(Pi * l), $MachinePrecision], -2000000.0], N[Not[LessEqual[N[(Pi * l), $MachinePrecision], 5e-5]], $MachinePrecision]], N[(Pi * l), $MachinePrecision], N[(Pi * N[(l - N[(l / N[Power[F, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\pi \cdot \ell \leq -2000000 \lor \neg \left(\pi \cdot \ell \leq 5 \cdot 10^{-5}\right):\\
\;\;\;\;\pi \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \left(\ell - \frac{\ell}{{F}^{2}}\right)\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < -2e6 or 5.00000000000000024e-5 < (*.f64 (PI.f64) l) Initial program 56.3%
sqr-neg56.3%
associate-*l/56.3%
*-lft-identity56.3%
sqr-neg56.3%
Simplified56.3%
Taylor expanded in l around 0 39.5%
Taylor expanded in F around inf 97.5%
if -2e6 < (*.f64 (PI.f64) l) < 5.00000000000000024e-5Initial program 90.5%
sqr-neg90.5%
associate-*l/91.1%
*-lft-identity91.1%
sqr-neg91.1%
Simplified91.1%
Taylor expanded in l around 0 90.9%
*-commutative90.9%
times-frac99.3%
Applied egg-rr99.3%
*-commutative99.3%
clear-num99.3%
un-div-inv99.3%
Applied egg-rr99.3%
*-commutative99.3%
associate-/r/99.3%
distribute-rgt-out--99.3%
associate-/l/90.8%
unpow290.8%
Applied egg-rr90.8%
Final simplification94.3%
(FPCore (F l) :precision binary64 (* PI l))
double code(double F, double l) {
return ((double) M_PI) * l;
}
public static double code(double F, double l) {
return Math.PI * l;
}
def code(F, l): return math.pi * l
function code(F, l) return Float64(pi * l) end
function tmp = code(F, l) tmp = pi * l; end
code[F_, l_] := N[(Pi * l), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot \ell
\end{array}
Initial program 73.0%
sqr-neg73.0%
associate-*l/73.3%
*-lft-identity73.3%
sqr-neg73.3%
Simplified73.3%
Taylor expanded in l around 0 64.6%
Taylor expanded in F around inf 74.1%
Final simplification74.1%
herbie shell --seed 2023301
(FPCore (F l)
:name "VandenBroeck and Keller, Equation (6)"
:precision binary64
(- (* PI l) (* (/ 1.0 (* F F)) (tan (* PI l)))))