
(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) 1000.0))) (* 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) <= 1000.0)) {
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) <= 1000.0)) {
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) <= 1000.0): 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) <= 1000.0)) 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) <= 1000.0))) 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], 1000.0]], $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 1000\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 1e3 < (*.f64 (PI.f64) l) Initial program 55.8%
associate-*l/55.8%
*-lft-identity55.8%
Simplified55.8%
Taylor expanded in l around 0 44.1%
unpow244.1%
Simplified44.1%
Taylor expanded in F around inf 99.6%
if -5e17 < (*.f64 (PI.f64) l) < 1e3Initial program 94.9%
associate-*l/95.1%
*-un-lft-identity95.1%
associate-/r*99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (F l) :precision binary64 (if (or (<= (* PI l) -5e+17) (not (<= (* PI l) 1e-5))) (* PI l) (- (* PI l) (* PI (/ l (* F F))))))
double code(double F, double l) {
double tmp;
if (((((double) M_PI) * l) <= -5e+17) || !((((double) M_PI) * l) <= 1e-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) <= -5e+17) || !((Math.PI * l) <= 1e-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) <= -5e+17) or not ((math.pi * l) <= 1e-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) <= -5e+17) || !(Float64(pi * l) <= 1e-5)) tmp = Float64(pi * l); else tmp = Float64(Float64(pi * l) - Float64(pi * Float64(l / Float64(F * F)))); end return tmp end
function tmp_2 = code(F, l) tmp = 0.0; if (((pi * l) <= -5e+17) || ~(((pi * l) <= 1e-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], -5e+17], N[Not[LessEqual[N[(Pi * l), $MachinePrecision], 1e-5]], $MachinePrecision]], N[(Pi * l), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] - N[(Pi * N[(l / N[(F * F), $MachinePrecision]), $MachinePrecision]), $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 10^{-5}\right):\\
\;\;\;\;\pi \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell - \pi \cdot \frac{\ell}{F \cdot F}\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < -5e17 or 1.00000000000000008e-5 < (*.f64 (PI.f64) l) Initial program 56.5%
associate-*l/56.5%
*-lft-identity56.5%
Simplified56.5%
Taylor expanded in l around 0 44.7%
unpow244.7%
Simplified44.7%
Taylor expanded in F around inf 99.5%
if -5e17 < (*.f64 (PI.f64) l) < 1.00000000000000008e-5Initial program 94.8%
Taylor expanded in l around 0 94.8%
associate-/l*94.8%
associate-/r/94.9%
unpow294.9%
Simplified94.9%
Final simplification97.0%
(FPCore (F l) :precision binary64 (if (or (<= (* PI l) -5e+17) (not (<= (* PI l) 1e-5))) (* PI l) (- (* PI l) (/ (/ l (/ F PI)) F))))
double code(double F, double l) {
double tmp;
if (((((double) M_PI) * l) <= -5e+17) || !((((double) M_PI) * l) <= 1e-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) <= -5e+17) || !((Math.PI * l) <= 1e-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) <= -5e+17) or not ((math.pi * l) <= 1e-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) <= -5e+17) || !(Float64(pi * l) <= 1e-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) <= -5e+17) || ~(((pi * l) <= 1e-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], -5e+17], N[Not[LessEqual[N[(Pi * l), $MachinePrecision], 1e-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 -5 \cdot 10^{+17} \lor \neg \left(\pi \cdot \ell \leq 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) < -5e17 or 1.00000000000000008e-5 < (*.f64 (PI.f64) l) Initial program 56.5%
associate-*l/56.5%
*-lft-identity56.5%
Simplified56.5%
Taylor expanded in l around 0 44.7%
unpow244.7%
Simplified44.7%
Taylor expanded in F around inf 99.5%
if -5e17 < (*.f64 (PI.f64) l) < 1.00000000000000008e-5Initial program 94.8%
associate-*l/95.0%
*-un-lft-identity95.0%
associate-/r*99.7%
Applied egg-rr99.7%
Taylor expanded in l around 0 99.5%
associate-/l*99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (F l) :precision binary64 (if (or (<= (* PI l) -5e+17) (not (<= (* PI l) 1e-5))) (* PI l) (* l (* PI (- 1.0 (pow F -2.0))))))
double code(double F, double l) {
double tmp;
if (((((double) M_PI) * l) <= -5e+17) || !((((double) M_PI) * l) <= 1e-5)) {
tmp = ((double) M_PI) * l;
} else {
tmp = l * (((double) M_PI) * (1.0 - pow(F, -2.0)));
}
return tmp;
}
public static double code(double F, double l) {
double tmp;
if (((Math.PI * l) <= -5e+17) || !((Math.PI * l) <= 1e-5)) {
tmp = Math.PI * l;
} else {
tmp = l * (Math.PI * (1.0 - Math.pow(F, -2.0)));
}
return tmp;
}
def code(F, l): tmp = 0 if ((math.pi * l) <= -5e+17) or not ((math.pi * l) <= 1e-5): tmp = math.pi * l else: tmp = l * (math.pi * (1.0 - math.pow(F, -2.0))) return tmp
function code(F, l) tmp = 0.0 if ((Float64(pi * l) <= -5e+17) || !(Float64(pi * l) <= 1e-5)) tmp = Float64(pi * l); else tmp = Float64(l * Float64(pi * Float64(1.0 - (F ^ -2.0)))); end return tmp end
function tmp_2 = code(F, l) tmp = 0.0; if (((pi * l) <= -5e+17) || ~(((pi * l) <= 1e-5))) tmp = pi * l; else tmp = l * (pi * (1.0 - (F ^ -2.0))); end tmp_2 = tmp; end
code[F_, l_] := If[Or[LessEqual[N[(Pi * l), $MachinePrecision], -5e+17], N[Not[LessEqual[N[(Pi * l), $MachinePrecision], 1e-5]], $MachinePrecision]], N[(Pi * l), $MachinePrecision], N[(l * N[(Pi * N[(1.0 - N[Power[F, -2.0], $MachinePrecision]), $MachinePrecision]), $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 10^{-5}\right):\\
\;\;\;\;\pi \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;\ell \cdot \left(\pi \cdot \left(1 - {F}^{-2}\right)\right)\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < -5e17 or 1.00000000000000008e-5 < (*.f64 (PI.f64) l) Initial program 56.5%
associate-*l/56.5%
*-lft-identity56.5%
Simplified56.5%
Taylor expanded in l around 0 44.7%
unpow244.7%
Simplified44.7%
Taylor expanded in F around inf 99.5%
if -5e17 < (*.f64 (PI.f64) l) < 1.00000000000000008e-5Initial program 94.8%
associate-*l/95.0%
*-lft-identity95.0%
Simplified95.0%
Taylor expanded in l around 0 94.6%
unpow294.6%
Simplified94.6%
sub-neg94.6%
distribute-lft-in94.6%
*-commutative94.6%
div-inv94.6%
distribute-lft-neg-in94.6%
pow294.6%
pow-flip94.6%
metadata-eval94.6%
Applied egg-rr94.6%
*-commutative94.6%
distribute-lft-in94.6%
cancel-sign-sub-inv94.6%
*-rgt-identity94.6%
distribute-lft-out--94.6%
Simplified94.6%
Final simplification96.9%
(FPCore (F l) :precision binary64 (if (or (<= (* PI l) -5e+17) (not (<= (* PI l) 1e-5))) (* PI l) (* l (* PI (+ 1.0 (/ -1.0 (* F F)))))))
double code(double F, double l) {
double tmp;
if (((((double) M_PI) * l) <= -5e+17) || !((((double) M_PI) * l) <= 1e-5)) {
tmp = ((double) M_PI) * l;
} else {
tmp = l * (((double) M_PI) * (1.0 + (-1.0 / (F * F))));
}
return tmp;
}
public static double code(double F, double l) {
double tmp;
if (((Math.PI * l) <= -5e+17) || !((Math.PI * l) <= 1e-5)) {
tmp = Math.PI * l;
} else {
tmp = l * (Math.PI * (1.0 + (-1.0 / (F * F))));
}
return tmp;
}
def code(F, l): tmp = 0 if ((math.pi * l) <= -5e+17) or not ((math.pi * l) <= 1e-5): tmp = math.pi * l else: tmp = l * (math.pi * (1.0 + (-1.0 / (F * F)))) return tmp
function code(F, l) tmp = 0.0 if ((Float64(pi * l) <= -5e+17) || !(Float64(pi * l) <= 1e-5)) tmp = Float64(pi * l); else tmp = Float64(l * Float64(pi * Float64(1.0 + Float64(-1.0 / Float64(F * F))))); end return tmp end
function tmp_2 = code(F, l) tmp = 0.0; if (((pi * l) <= -5e+17) || ~(((pi * l) <= 1e-5))) tmp = pi * l; else tmp = l * (pi * (1.0 + (-1.0 / (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], 1e-5]], $MachinePrecision]], N[(Pi * l), $MachinePrecision], N[(l * N[(Pi * N[(1.0 + N[(-1.0 / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 10^{-5}\right):\\
\;\;\;\;\pi \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;\ell \cdot \left(\pi \cdot \left(1 + \frac{-1}{F \cdot F}\right)\right)\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < -5e17 or 1.00000000000000008e-5 < (*.f64 (PI.f64) l) Initial program 56.5%
associate-*l/56.5%
*-lft-identity56.5%
Simplified56.5%
Taylor expanded in l around 0 44.7%
unpow244.7%
Simplified44.7%
Taylor expanded in F around inf 99.5%
if -5e17 < (*.f64 (PI.f64) l) < 1.00000000000000008e-5Initial program 94.8%
associate-*l/95.0%
*-lft-identity95.0%
Simplified95.0%
Taylor expanded in l around 0 94.6%
unpow294.6%
Simplified94.6%
sub-neg94.6%
distribute-lft-in94.6%
*-commutative94.6%
div-inv94.6%
distribute-lft-neg-in94.6%
pow294.6%
pow-flip94.6%
metadata-eval94.6%
Applied egg-rr94.6%
*-commutative94.6%
distribute-lft-in94.6%
cancel-sign-sub-inv94.6%
*-rgt-identity94.6%
distribute-lft-out--94.6%
Simplified94.6%
Taylor expanded in l around 0 94.6%
*-commutative94.6%
unpow294.6%
Simplified94.6%
Final simplification96.9%
(FPCore (F l)
:precision binary64
(let* ((t_0 (* (/ PI F) (/ (- l) F))))
(if (<= F 1.25e-271)
t_0
(if (<= F 1.45e-108)
(+ (* PI l) -1.0)
(if (<= F 4.2e-15) t_0 (* PI l))))))
double code(double F, double l) {
double t_0 = (((double) M_PI) / F) * (-l / F);
double tmp;
if (F <= 1.25e-271) {
tmp = t_0;
} else if (F <= 1.45e-108) {
tmp = (((double) M_PI) * l) + -1.0;
} else if (F <= 4.2e-15) {
tmp = t_0;
} else {
tmp = ((double) M_PI) * l;
}
return tmp;
}
public static double code(double F, double l) {
double t_0 = (Math.PI / F) * (-l / F);
double tmp;
if (F <= 1.25e-271) {
tmp = t_0;
} else if (F <= 1.45e-108) {
tmp = (Math.PI * l) + -1.0;
} else if (F <= 4.2e-15) {
tmp = t_0;
} else {
tmp = Math.PI * l;
}
return tmp;
}
def code(F, l): t_0 = (math.pi / F) * (-l / F) tmp = 0 if F <= 1.25e-271: tmp = t_0 elif F <= 1.45e-108: tmp = (math.pi * l) + -1.0 elif F <= 4.2e-15: tmp = t_0 else: tmp = math.pi * l return tmp
function code(F, l) t_0 = Float64(Float64(pi / F) * Float64(Float64(-l) / F)) tmp = 0.0 if (F <= 1.25e-271) tmp = t_0; elseif (F <= 1.45e-108) tmp = Float64(Float64(pi * l) + -1.0); elseif (F <= 4.2e-15) tmp = t_0; else tmp = Float64(pi * l); end return tmp end
function tmp_2 = code(F, l) t_0 = (pi / F) * (-l / F); tmp = 0.0; if (F <= 1.25e-271) tmp = t_0; elseif (F <= 1.45e-108) tmp = (pi * l) + -1.0; elseif (F <= 4.2e-15) tmp = t_0; else tmp = pi * l; end tmp_2 = tmp; end
code[F_, l_] := Block[{t$95$0 = N[(N[(Pi / F), $MachinePrecision] * N[((-l) / F), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, 1.25e-271], t$95$0, If[LessEqual[F, 1.45e-108], N[(N[(Pi * l), $MachinePrecision] + -1.0), $MachinePrecision], If[LessEqual[F, 4.2e-15], t$95$0, N[(Pi * l), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\pi}{F} \cdot \frac{-\ell}{F}\\
\mathbf{if}\;F \leq 1.25 \cdot 10^{-271}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;F \leq 1.45 \cdot 10^{-108}:\\
\;\;\;\;\pi \cdot \ell + -1\\
\mathbf{elif}\;F \leq 4.2 \cdot 10^{-15}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell\\
\end{array}
\end{array}
if F < 1.2500000000000001e-271 or 1.45e-108 < F < 4.19999999999999962e-15Initial program 74.4%
associate-*l/74.4%
*-lft-identity74.4%
Simplified74.4%
Taylor expanded in l around 0 66.3%
unpow266.3%
Simplified66.3%
Taylor expanded in F around 0 30.2%
associate-*r/30.2%
neg-mul-130.2%
unpow230.2%
Simplified30.2%
Taylor expanded in l around 0 30.2%
mul-1-neg30.2%
*-commutative30.2%
unpow230.2%
times-frac32.6%
Simplified32.6%
if 1.2500000000000001e-271 < F < 1.45e-108Initial program 36.7%
associate-/r/37.6%
inv-pow37.6%
pow-to-exp9.7%
associate-/l*14.6%
Applied egg-rr14.6%
Applied egg-rr31.4%
*-inverses59.4%
Simplified59.4%
if 4.19999999999999962e-15 < F Initial program 99.7%
associate-*l/99.6%
*-lft-identity99.6%
Simplified99.6%
Taylor expanded in l around 0 99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in F around inf 93.5%
Final simplification51.8%
(FPCore (F l)
:precision binary64
(let* ((t_0 (/ (- l) F)))
(if (<= F 9.5e-272)
(* (/ PI F) t_0)
(if (<= F 1.35e-108)
(+ (* PI l) -1.0)
(if (<= F 1.7e-14) (* PI (/ t_0 F)) (* PI l))))))
double code(double F, double l) {
double t_0 = -l / F;
double tmp;
if (F <= 9.5e-272) {
tmp = (((double) M_PI) / F) * t_0;
} else if (F <= 1.35e-108) {
tmp = (((double) M_PI) * l) + -1.0;
} else if (F <= 1.7e-14) {
tmp = ((double) M_PI) * (t_0 / F);
} else {
tmp = ((double) M_PI) * l;
}
return tmp;
}
public static double code(double F, double l) {
double t_0 = -l / F;
double tmp;
if (F <= 9.5e-272) {
tmp = (Math.PI / F) * t_0;
} else if (F <= 1.35e-108) {
tmp = (Math.PI * l) + -1.0;
} else if (F <= 1.7e-14) {
tmp = Math.PI * (t_0 / F);
} else {
tmp = Math.PI * l;
}
return tmp;
}
def code(F, l): t_0 = -l / F tmp = 0 if F <= 9.5e-272: tmp = (math.pi / F) * t_0 elif F <= 1.35e-108: tmp = (math.pi * l) + -1.0 elif F <= 1.7e-14: tmp = math.pi * (t_0 / F) else: tmp = math.pi * l return tmp
function code(F, l) t_0 = Float64(Float64(-l) / F) tmp = 0.0 if (F <= 9.5e-272) tmp = Float64(Float64(pi / F) * t_0); elseif (F <= 1.35e-108) tmp = Float64(Float64(pi * l) + -1.0); elseif (F <= 1.7e-14) tmp = Float64(pi * Float64(t_0 / F)); else tmp = Float64(pi * l); end return tmp end
function tmp_2 = code(F, l) t_0 = -l / F; tmp = 0.0; if (F <= 9.5e-272) tmp = (pi / F) * t_0; elseif (F <= 1.35e-108) tmp = (pi * l) + -1.0; elseif (F <= 1.7e-14) tmp = pi * (t_0 / F); else tmp = pi * l; end tmp_2 = tmp; end
code[F_, l_] := Block[{t$95$0 = N[((-l) / F), $MachinePrecision]}, If[LessEqual[F, 9.5e-272], N[(N[(Pi / F), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[F, 1.35e-108], N[(N[(Pi * l), $MachinePrecision] + -1.0), $MachinePrecision], If[LessEqual[F, 1.7e-14], N[(Pi * N[(t$95$0 / F), $MachinePrecision]), $MachinePrecision], N[(Pi * l), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-\ell}{F}\\
\mathbf{if}\;F \leq 9.5 \cdot 10^{-272}:\\
\;\;\;\;\frac{\pi}{F} \cdot t_0\\
\mathbf{elif}\;F \leq 1.35 \cdot 10^{-108}:\\
\;\;\;\;\pi \cdot \ell + -1\\
\mathbf{elif}\;F \leq 1.7 \cdot 10^{-14}:\\
\;\;\;\;\pi \cdot \frac{t_0}{F}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell\\
\end{array}
\end{array}
if F < 9.50000000000000024e-272Initial program 75.2%
associate-*l/75.2%
*-lft-identity75.2%
Simplified75.2%
Taylor expanded in l around 0 67.0%
unpow267.0%
Simplified67.0%
Taylor expanded in F around 0 27.2%
associate-*r/27.2%
neg-mul-127.2%
unpow227.2%
Simplified27.2%
Taylor expanded in l around 0 27.1%
mul-1-neg27.1%
*-commutative27.1%
unpow227.1%
times-frac29.7%
Simplified29.7%
if 9.50000000000000024e-272 < F < 1.35000000000000002e-108Initial program 36.7%
associate-/r/37.6%
inv-pow37.6%
pow-to-exp9.7%
associate-/l*14.6%
Applied egg-rr14.6%
Applied egg-rr31.4%
*-inverses59.4%
Simplified59.4%
if 1.35000000000000002e-108 < F < 1.70000000000000001e-14Initial program 66.7%
associate-*l/66.9%
*-lft-identity66.9%
Simplified66.9%
Taylor expanded in l around 0 59.8%
unpow259.8%
Simplified59.8%
Taylor expanded in F around 0 60.0%
mul-1-neg60.0%
associate-/l*59.9%
unpow259.9%
associate-*r/59.8%
Simplified59.8%
associate-/r*60.0%
associate-/r/60.0%
Applied egg-rr60.0%
if 1.70000000000000001e-14 < F Initial program 99.7%
associate-*l/99.6%
*-lft-identity99.6%
Simplified99.6%
Taylor expanded in l around 0 99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in F around inf 93.5%
Final simplification51.8%
(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 76.9%
associate-*l/77.0%
*-lft-identity77.0%
Simplified77.0%
Taylor expanded in l around 0 71.2%
unpow271.2%
Simplified71.2%
Taylor expanded in F around inf 74.3%
Final simplification74.3%
herbie shell --seed 2023227
(FPCore (F l)
:name "VandenBroeck and Keller, Equation (6)"
:precision binary64
(- (* PI l) (* (/ 1.0 (* F F)) (tan (* PI l)))))