
(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}
l_m = (fabs.f64 l)
l_s = (copysign.f64 1 l)
(FPCore (l_s F l_m)
:precision binary64
(*
l_s
(if (<= (* PI l_m) 2e+15)
(fma PI l_m (/ (/ (tan (* PI l_m)) (- F)) F))
(* PI l_m))))l_m = fabs(l);
l_s = copysign(1.0, l);
double code(double l_s, double F, double l_m) {
double tmp;
if ((((double) M_PI) * l_m) <= 2e+15) {
tmp = fma(((double) M_PI), l_m, ((tan((((double) M_PI) * l_m)) / -F) / F));
} else {
tmp = ((double) M_PI) * l_m;
}
return l_s * tmp;
}
l_m = abs(l) l_s = copysign(1.0, l) function code(l_s, F, l_m) tmp = 0.0 if (Float64(pi * l_m) <= 2e+15) tmp = fma(pi, l_m, Float64(Float64(tan(Float64(pi * l_m)) / Float64(-F)) / F)); else tmp = Float64(pi * l_m); end return Float64(l_s * tmp) end
l_m = N[Abs[l], $MachinePrecision]
l_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[l]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[l$95$s_, F_, l$95$m_] := N[(l$95$s * If[LessEqual[N[(Pi * l$95$m), $MachinePrecision], 2e+15], N[(Pi * l$95$m + N[(N[(N[Tan[N[(Pi * l$95$m), $MachinePrecision]], $MachinePrecision] / (-F)), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision], N[(Pi * l$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
l_s = \mathsf{copysign}\left(1, \ell\right)
\\
l_s \cdot \begin{array}{l}
\mathbf{if}\;\pi \cdot l_m \leq 2 \cdot 10^{+15}:\\
\;\;\;\;\mathsf{fma}\left(\pi, l_m, \frac{\frac{\tan \left(\pi \cdot l_m\right)}{-F}}{F}\right)\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot l_m\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 2e15Initial program 78.4%
fma-neg78.4%
distribute-lft-neg-in78.4%
sqr-neg78.4%
distribute-neg-frac78.4%
metadata-eval78.4%
distribute-lft-neg-out78.4%
neg-mul-178.4%
associate-/r*78.4%
metadata-eval78.4%
associate-*l/78.5%
*-lft-identity78.5%
associate-/l/85.0%
Simplified85.0%
if 2e15 < (*.f64 (PI.f64) l) Initial program 68.0%
fma-neg68.0%
distribute-lft-neg-in68.0%
sqr-neg68.0%
distribute-neg-frac68.0%
metadata-eval68.0%
distribute-lft-neg-out68.0%
neg-mul-168.0%
associate-/r*68.0%
metadata-eval68.0%
associate-*l/68.0%
*-lft-identity68.0%
associate-/l/68.0%
Simplified68.0%
add-sqr-sqrt68.4%
pow268.4%
Applied egg-rr68.4%
Taylor expanded in l around 0 99.6%
Final simplification89.4%
l_m = (fabs.f64 l)
l_s = (copysign.f64 1 l)
(FPCore (l_s F l_m)
:precision binary64
(*
l_s
(if (or (<= (* PI l_m) 1e-155)
(not
(or (<= (* PI l_m) 1e-129)
(and (not (<= (* PI l_m) 4e-97)) (<= (* PI l_m) 0.2)))))
(* PI l_m)
(/ (- (/ PI F)) (/ F l_m)))))l_m = fabs(l);
l_s = copysign(1.0, l);
double code(double l_s, double F, double l_m) {
double tmp;
if (((((double) M_PI) * l_m) <= 1e-155) || !(((((double) M_PI) * l_m) <= 1e-129) || (!((((double) M_PI) * l_m) <= 4e-97) && ((((double) M_PI) * l_m) <= 0.2)))) {
tmp = ((double) M_PI) * l_m;
} else {
tmp = -(((double) M_PI) / F) / (F / l_m);
}
return l_s * tmp;
}
l_m = Math.abs(l);
l_s = Math.copySign(1.0, l);
public static double code(double l_s, double F, double l_m) {
double tmp;
if (((Math.PI * l_m) <= 1e-155) || !(((Math.PI * l_m) <= 1e-129) || (!((Math.PI * l_m) <= 4e-97) && ((Math.PI * l_m) <= 0.2)))) {
tmp = Math.PI * l_m;
} else {
tmp = -(Math.PI / F) / (F / l_m);
}
return l_s * tmp;
}
l_m = math.fabs(l) l_s = math.copysign(1.0, l) def code(l_s, F, l_m): tmp = 0 if ((math.pi * l_m) <= 1e-155) or not (((math.pi * l_m) <= 1e-129) or (not ((math.pi * l_m) <= 4e-97) and ((math.pi * l_m) <= 0.2))): tmp = math.pi * l_m else: tmp = -(math.pi / F) / (F / l_m) return l_s * tmp
l_m = abs(l) l_s = copysign(1.0, l) function code(l_s, F, l_m) tmp = 0.0 if ((Float64(pi * l_m) <= 1e-155) || !((Float64(pi * l_m) <= 1e-129) || (!(Float64(pi * l_m) <= 4e-97) && (Float64(pi * l_m) <= 0.2)))) tmp = Float64(pi * l_m); else tmp = Float64(Float64(-Float64(pi / F)) / Float64(F / l_m)); end return Float64(l_s * tmp) end
l_m = abs(l); l_s = sign(l) * abs(1.0); function tmp_2 = code(l_s, F, l_m) tmp = 0.0; if (((pi * l_m) <= 1e-155) || ~((((pi * l_m) <= 1e-129) || (~(((pi * l_m) <= 4e-97)) && ((pi * l_m) <= 0.2))))) tmp = pi * l_m; else tmp = -(pi / F) / (F / l_m); end tmp_2 = l_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
l_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[l]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[l$95$s_, F_, l$95$m_] := N[(l$95$s * If[Or[LessEqual[N[(Pi * l$95$m), $MachinePrecision], 1e-155], N[Not[Or[LessEqual[N[(Pi * l$95$m), $MachinePrecision], 1e-129], And[N[Not[LessEqual[N[(Pi * l$95$m), $MachinePrecision], 4e-97]], $MachinePrecision], LessEqual[N[(Pi * l$95$m), $MachinePrecision], 0.2]]]], $MachinePrecision]], N[(Pi * l$95$m), $MachinePrecision], N[((-N[(Pi / F), $MachinePrecision]) / N[(F / l$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
l_s = \mathsf{copysign}\left(1, \ell\right)
\\
l_s \cdot \begin{array}{l}
\mathbf{if}\;\pi \cdot l_m \leq 10^{-155} \lor \neg \left(\pi \cdot l_m \leq 10^{-129} \lor \neg \left(\pi \cdot l_m \leq 4 \cdot 10^{-97}\right) \land \pi \cdot l_m \leq 0.2\right):\\
\;\;\;\;\pi \cdot l_m\\
\mathbf{else}:\\
\;\;\;\;\frac{-\frac{\pi}{F}}{\frac{F}{l_m}}\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 1.00000000000000001e-155 or 9.9999999999999993e-130 < (*.f64 (PI.f64) l) < 4.00000000000000014e-97 or 0.20000000000000001 < (*.f64 (PI.f64) l) Initial program 73.7%
fma-neg73.8%
distribute-lft-neg-in73.8%
sqr-neg73.8%
distribute-neg-frac73.8%
metadata-eval73.8%
distribute-lft-neg-out73.8%
neg-mul-173.8%
associate-/r*73.8%
metadata-eval73.8%
associate-*l/73.8%
*-lft-identity73.8%
associate-/l/78.0%
Simplified78.0%
add-sqr-sqrt34.6%
pow234.6%
Applied egg-rr34.6%
Taylor expanded in l around 0 84.0%
if 1.00000000000000001e-155 < (*.f64 (PI.f64) l) < 9.9999999999999993e-130 or 4.00000000000000014e-97 < (*.f64 (PI.f64) l) < 0.20000000000000001Initial program 91.3%
sqr-neg91.3%
associate-*l/91.4%
sqr-neg91.4%
*-lft-identity91.4%
Simplified91.4%
Taylor expanded in l around 0 88.3%
Taylor expanded in F around 0 65.3%
mul-1-neg65.3%
associate-*r/65.2%
*-commutative65.2%
distribute-rgt-neg-in65.2%
Simplified65.2%
unpow265.2%
associate-/r*65.2%
distribute-rgt-neg-in65.2%
associate-/r/73.6%
distribute-neg-frac73.6%
distribute-neg-frac73.6%
Applied egg-rr73.6%
Final simplification83.1%
l_m = (fabs.f64 l)
l_s = (copysign.f64 1 l)
(FPCore (l_s F l_m)
:precision binary64
(*
l_s
(if (<= (* PI l_m) 2e+15)
(+ (* PI l_m) (* (/ (tan (* PI l_m)) F) (/ -1.0 F)))
(* PI l_m))))l_m = fabs(l);
l_s = copysign(1.0, l);
double code(double l_s, double F, double l_m) {
double tmp;
if ((((double) M_PI) * l_m) <= 2e+15) {
tmp = (((double) M_PI) * l_m) + ((tan((((double) M_PI) * l_m)) / F) * (-1.0 / F));
} else {
tmp = ((double) M_PI) * l_m;
}
return l_s * tmp;
}
l_m = Math.abs(l);
l_s = Math.copySign(1.0, l);
public static double code(double l_s, double F, double l_m) {
double tmp;
if ((Math.PI * l_m) <= 2e+15) {
tmp = (Math.PI * l_m) + ((Math.tan((Math.PI * l_m)) / F) * (-1.0 / F));
} else {
tmp = Math.PI * l_m;
}
return l_s * tmp;
}
l_m = math.fabs(l) l_s = math.copysign(1.0, l) def code(l_s, F, l_m): tmp = 0 if (math.pi * l_m) <= 2e+15: tmp = (math.pi * l_m) + ((math.tan((math.pi * l_m)) / F) * (-1.0 / F)) else: tmp = math.pi * l_m return l_s * tmp
l_m = abs(l) l_s = copysign(1.0, l) function code(l_s, F, l_m) tmp = 0.0 if (Float64(pi * l_m) <= 2e+15) tmp = Float64(Float64(pi * l_m) + Float64(Float64(tan(Float64(pi * l_m)) / F) * Float64(-1.0 / F))); else tmp = Float64(pi * l_m); end return Float64(l_s * tmp) end
l_m = abs(l); l_s = sign(l) * abs(1.0); function tmp_2 = code(l_s, F, l_m) tmp = 0.0; if ((pi * l_m) <= 2e+15) tmp = (pi * l_m) + ((tan((pi * l_m)) / F) * (-1.0 / F)); else tmp = pi * l_m; end tmp_2 = l_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
l_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[l]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[l$95$s_, F_, l$95$m_] := N[(l$95$s * If[LessEqual[N[(Pi * l$95$m), $MachinePrecision], 2e+15], N[(N[(Pi * l$95$m), $MachinePrecision] + N[(N[(N[Tan[N[(Pi * l$95$m), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision] * N[(-1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(Pi * l$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
l_s = \mathsf{copysign}\left(1, \ell\right)
\\
l_s \cdot \begin{array}{l}
\mathbf{if}\;\pi \cdot l_m \leq 2 \cdot 10^{+15}:\\
\;\;\;\;\pi \cdot l_m + \frac{\tan \left(\pi \cdot l_m\right)}{F} \cdot \frac{-1}{F}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot l_m\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 2e15Initial program 78.4%
sqr-neg78.4%
associate-*l/78.5%
sqr-neg78.5%
*-lft-identity78.5%
Simplified78.5%
associate-/r*85.0%
div-inv85.0%
Applied egg-rr85.0%
if 2e15 < (*.f64 (PI.f64) l) Initial program 68.0%
fma-neg68.0%
distribute-lft-neg-in68.0%
sqr-neg68.0%
distribute-neg-frac68.0%
metadata-eval68.0%
distribute-lft-neg-out68.0%
neg-mul-168.0%
associate-/r*68.0%
metadata-eval68.0%
associate-*l/68.0%
*-lft-identity68.0%
associate-/l/68.0%
Simplified68.0%
add-sqr-sqrt68.4%
pow268.4%
Applied egg-rr68.4%
Taylor expanded in l around 0 99.6%
Final simplification89.4%
l_m = (fabs.f64 l)
l_s = (copysign.f64 1 l)
(FPCore (l_s F l_m)
:precision binary64
(*
l_s
(if (<= (* PI l_m) 2e+15)
(- (* PI l_m) (/ (/ (tan (* PI l_m)) F) F))
(* PI l_m))))l_m = fabs(l);
l_s = copysign(1.0, l);
double code(double l_s, double F, double l_m) {
double tmp;
if ((((double) M_PI) * l_m) <= 2e+15) {
tmp = (((double) M_PI) * l_m) - ((tan((((double) M_PI) * l_m)) / F) / F);
} else {
tmp = ((double) M_PI) * l_m;
}
return l_s * tmp;
}
l_m = Math.abs(l);
l_s = Math.copySign(1.0, l);
public static double code(double l_s, double F, double l_m) {
double tmp;
if ((Math.PI * l_m) <= 2e+15) {
tmp = (Math.PI * l_m) - ((Math.tan((Math.PI * l_m)) / F) / F);
} else {
tmp = Math.PI * l_m;
}
return l_s * tmp;
}
l_m = math.fabs(l) l_s = math.copysign(1.0, l) def code(l_s, F, l_m): tmp = 0 if (math.pi * l_m) <= 2e+15: tmp = (math.pi * l_m) - ((math.tan((math.pi * l_m)) / F) / F) else: tmp = math.pi * l_m return l_s * tmp
l_m = abs(l) l_s = copysign(1.0, l) function code(l_s, F, l_m) tmp = 0.0 if (Float64(pi * l_m) <= 2e+15) tmp = Float64(Float64(pi * l_m) - Float64(Float64(tan(Float64(pi * l_m)) / F) / F)); else tmp = Float64(pi * l_m); end return Float64(l_s * tmp) end
l_m = abs(l); l_s = sign(l) * abs(1.0); function tmp_2 = code(l_s, F, l_m) tmp = 0.0; if ((pi * l_m) <= 2e+15) tmp = (pi * l_m) - ((tan((pi * l_m)) / F) / F); else tmp = pi * l_m; end tmp_2 = l_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
l_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[l]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[l$95$s_, F_, l$95$m_] := N[(l$95$s * If[LessEqual[N[(Pi * l$95$m), $MachinePrecision], 2e+15], N[(N[(Pi * l$95$m), $MachinePrecision] - N[(N[(N[Tan[N[(Pi * l$95$m), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision], N[(Pi * l$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
l_s = \mathsf{copysign}\left(1, \ell\right)
\\
l_s \cdot \begin{array}{l}
\mathbf{if}\;\pi \cdot l_m \leq 2 \cdot 10^{+15}:\\
\;\;\;\;\pi \cdot l_m - \frac{\frac{\tan \left(\pi \cdot l_m\right)}{F}}{F}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot l_m\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 2e15Initial program 78.4%
associate-*l/78.5%
*-un-lft-identity78.5%
associate-/r*85.0%
Applied egg-rr85.0%
if 2e15 < (*.f64 (PI.f64) l) Initial program 68.0%
fma-neg68.0%
distribute-lft-neg-in68.0%
sqr-neg68.0%
distribute-neg-frac68.0%
metadata-eval68.0%
distribute-lft-neg-out68.0%
neg-mul-168.0%
associate-/r*68.0%
metadata-eval68.0%
associate-*l/68.0%
*-lft-identity68.0%
associate-/l/68.0%
Simplified68.0%
add-sqr-sqrt68.4%
pow268.4%
Applied egg-rr68.4%
Taylor expanded in l around 0 99.6%
Final simplification89.4%
l_m = (fabs.f64 l)
l_s = (copysign.f64 1 l)
(FPCore (l_s F l_m)
:precision binary64
(*
l_s
(if (<= (* PI l_m) 50000000000.0)
(- (* PI l_m) (* (/ PI F) (/ l_m F)))
(* PI l_m))))l_m = fabs(l);
l_s = copysign(1.0, l);
double code(double l_s, double F, double l_m) {
double tmp;
if ((((double) M_PI) * l_m) <= 50000000000.0) {
tmp = (((double) M_PI) * l_m) - ((((double) M_PI) / F) * (l_m / F));
} else {
tmp = ((double) M_PI) * l_m;
}
return l_s * tmp;
}
l_m = Math.abs(l);
l_s = Math.copySign(1.0, l);
public static double code(double l_s, double F, double l_m) {
double tmp;
if ((Math.PI * l_m) <= 50000000000.0) {
tmp = (Math.PI * l_m) - ((Math.PI / F) * (l_m / F));
} else {
tmp = Math.PI * l_m;
}
return l_s * tmp;
}
l_m = math.fabs(l) l_s = math.copysign(1.0, l) def code(l_s, F, l_m): tmp = 0 if (math.pi * l_m) <= 50000000000.0: tmp = (math.pi * l_m) - ((math.pi / F) * (l_m / F)) else: tmp = math.pi * l_m return l_s * tmp
l_m = abs(l) l_s = copysign(1.0, l) function code(l_s, F, l_m) tmp = 0.0 if (Float64(pi * l_m) <= 50000000000.0) tmp = Float64(Float64(pi * l_m) - Float64(Float64(pi / F) * Float64(l_m / F))); else tmp = Float64(pi * l_m); end return Float64(l_s * tmp) end
l_m = abs(l); l_s = sign(l) * abs(1.0); function tmp_2 = code(l_s, F, l_m) tmp = 0.0; if ((pi * l_m) <= 50000000000.0) tmp = (pi * l_m) - ((pi / F) * (l_m / F)); else tmp = pi * l_m; end tmp_2 = l_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
l_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[l]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[l$95$s_, F_, l$95$m_] := N[(l$95$s * If[LessEqual[N[(Pi * l$95$m), $MachinePrecision], 50000000000.0], N[(N[(Pi * l$95$m), $MachinePrecision] - N[(N[(Pi / F), $MachinePrecision] * N[(l$95$m / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(Pi * l$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
l_s = \mathsf{copysign}\left(1, \ell\right)
\\
l_s \cdot \begin{array}{l}
\mathbf{if}\;\pi \cdot l_m \leq 50000000000:\\
\;\;\;\;\pi \cdot l_m - \frac{\pi}{F} \cdot \frac{l_m}{F}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot l_m\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 5e10Initial program 78.3%
sqr-neg78.3%
associate-*l/78.4%
sqr-neg78.4%
*-lft-identity78.4%
Simplified78.4%
Taylor expanded in l around 0 70.7%
*-commutative70.7%
times-frac77.2%
Applied egg-rr77.2%
if 5e10 < (*.f64 (PI.f64) l) Initial program 68.4%
fma-neg68.4%
distribute-lft-neg-in68.4%
sqr-neg68.4%
distribute-neg-frac68.4%
metadata-eval68.4%
distribute-lft-neg-out68.4%
neg-mul-168.4%
associate-/r*68.4%
metadata-eval68.4%
associate-*l/68.4%
*-lft-identity68.4%
associate-/l/68.4%
Simplified68.4%
add-sqr-sqrt68.8%
pow268.8%
Applied egg-rr68.8%
Taylor expanded in l around 0 98.3%
Final simplification83.7%
l_m = (fabs.f64 l)
l_s = (copysign.f64 1 l)
(FPCore (l_s F l_m)
:precision binary64
(*
l_s
(if (<= (* PI l_m) 50000000000.0)
(- (* PI l_m) (/ (/ l_m (/ F PI)) F))
(* PI l_m))))l_m = fabs(l);
l_s = copysign(1.0, l);
double code(double l_s, double F, double l_m) {
double tmp;
if ((((double) M_PI) * l_m) <= 50000000000.0) {
tmp = (((double) M_PI) * l_m) - ((l_m / (F / ((double) M_PI))) / F);
} else {
tmp = ((double) M_PI) * l_m;
}
return l_s * tmp;
}
l_m = Math.abs(l);
l_s = Math.copySign(1.0, l);
public static double code(double l_s, double F, double l_m) {
double tmp;
if ((Math.PI * l_m) <= 50000000000.0) {
tmp = (Math.PI * l_m) - ((l_m / (F / Math.PI)) / F);
} else {
tmp = Math.PI * l_m;
}
return l_s * tmp;
}
l_m = math.fabs(l) l_s = math.copysign(1.0, l) def code(l_s, F, l_m): tmp = 0 if (math.pi * l_m) <= 50000000000.0: tmp = (math.pi * l_m) - ((l_m / (F / math.pi)) / F) else: tmp = math.pi * l_m return l_s * tmp
l_m = abs(l) l_s = copysign(1.0, l) function code(l_s, F, l_m) tmp = 0.0 if (Float64(pi * l_m) <= 50000000000.0) tmp = Float64(Float64(pi * l_m) - Float64(Float64(l_m / Float64(F / pi)) / F)); else tmp = Float64(pi * l_m); end return Float64(l_s * tmp) end
l_m = abs(l); l_s = sign(l) * abs(1.0); function tmp_2 = code(l_s, F, l_m) tmp = 0.0; if ((pi * l_m) <= 50000000000.0) tmp = (pi * l_m) - ((l_m / (F / pi)) / F); else tmp = pi * l_m; end tmp_2 = l_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
l_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[l]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[l$95$s_, F_, l$95$m_] := N[(l$95$s * If[LessEqual[N[(Pi * l$95$m), $MachinePrecision], 50000000000.0], N[(N[(Pi * l$95$m), $MachinePrecision] - N[(N[(l$95$m / N[(F / Pi), $MachinePrecision]), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision], N[(Pi * l$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
l_s = \mathsf{copysign}\left(1, \ell\right)
\\
l_s \cdot \begin{array}{l}
\mathbf{if}\;\pi \cdot l_m \leq 50000000000:\\
\;\;\;\;\pi \cdot l_m - \frac{\frac{l_m}{\frac{F}{\pi}}}{F}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot l_m\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 5e10Initial program 78.3%
associate-*l/78.4%
*-un-lft-identity78.4%
associate-/r*84.9%
Applied egg-rr84.9%
Taylor expanded in l around 0 77.2%
associate-/l*77.2%
Simplified77.2%
if 5e10 < (*.f64 (PI.f64) l) Initial program 68.4%
fma-neg68.4%
distribute-lft-neg-in68.4%
sqr-neg68.4%
distribute-neg-frac68.4%
metadata-eval68.4%
distribute-lft-neg-out68.4%
neg-mul-168.4%
associate-/r*68.4%
metadata-eval68.4%
associate-*l/68.4%
*-lft-identity68.4%
associate-/l/68.4%
Simplified68.4%
add-sqr-sqrt68.8%
pow268.8%
Applied egg-rr68.8%
Taylor expanded in l around 0 98.3%
Final simplification83.7%
l_m = (fabs.f64 l)
l_s = (copysign.f64 1 l)
(FPCore (l_s F l_m)
:precision binary64
(*
l_s
(if (<= (* PI l_m) 50000000000.0)
(- (* PI l_m) (/ (/ PI F) (/ F l_m)))
(* PI l_m))))l_m = fabs(l);
l_s = copysign(1.0, l);
double code(double l_s, double F, double l_m) {
double tmp;
if ((((double) M_PI) * l_m) <= 50000000000.0) {
tmp = (((double) M_PI) * l_m) - ((((double) M_PI) / F) / (F / l_m));
} else {
tmp = ((double) M_PI) * l_m;
}
return l_s * tmp;
}
l_m = Math.abs(l);
l_s = Math.copySign(1.0, l);
public static double code(double l_s, double F, double l_m) {
double tmp;
if ((Math.PI * l_m) <= 50000000000.0) {
tmp = (Math.PI * l_m) - ((Math.PI / F) / (F / l_m));
} else {
tmp = Math.PI * l_m;
}
return l_s * tmp;
}
l_m = math.fabs(l) l_s = math.copysign(1.0, l) def code(l_s, F, l_m): tmp = 0 if (math.pi * l_m) <= 50000000000.0: tmp = (math.pi * l_m) - ((math.pi / F) / (F / l_m)) else: tmp = math.pi * l_m return l_s * tmp
l_m = abs(l) l_s = copysign(1.0, l) function code(l_s, F, l_m) tmp = 0.0 if (Float64(pi * l_m) <= 50000000000.0) tmp = Float64(Float64(pi * l_m) - Float64(Float64(pi / F) / Float64(F / l_m))); else tmp = Float64(pi * l_m); end return Float64(l_s * tmp) end
l_m = abs(l); l_s = sign(l) * abs(1.0); function tmp_2 = code(l_s, F, l_m) tmp = 0.0; if ((pi * l_m) <= 50000000000.0) tmp = (pi * l_m) - ((pi / F) / (F / l_m)); else tmp = pi * l_m; end tmp_2 = l_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
l_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[l]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[l$95$s_, F_, l$95$m_] := N[(l$95$s * If[LessEqual[N[(Pi * l$95$m), $MachinePrecision], 50000000000.0], N[(N[(Pi * l$95$m), $MachinePrecision] - N[(N[(Pi / F), $MachinePrecision] / N[(F / l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(Pi * l$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
l_s = \mathsf{copysign}\left(1, \ell\right)
\\
l_s \cdot \begin{array}{l}
\mathbf{if}\;\pi \cdot l_m \leq 50000000000:\\
\;\;\;\;\pi \cdot l_m - \frac{\frac{\pi}{F}}{\frac{F}{l_m}}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot l_m\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 5e10Initial program 78.3%
sqr-neg78.3%
associate-*l/78.4%
sqr-neg78.4%
*-lft-identity78.4%
Simplified78.4%
Taylor expanded in l around 0 70.7%
*-commutative70.7%
times-frac77.2%
Applied egg-rr77.2%
clear-num77.2%
un-div-inv77.3%
Applied egg-rr77.3%
if 5e10 < (*.f64 (PI.f64) l) Initial program 68.4%
fma-neg68.4%
distribute-lft-neg-in68.4%
sqr-neg68.4%
distribute-neg-frac68.4%
metadata-eval68.4%
distribute-lft-neg-out68.4%
neg-mul-168.4%
associate-/r*68.4%
metadata-eval68.4%
associate-*l/68.4%
*-lft-identity68.4%
associate-/l/68.4%
Simplified68.4%
add-sqr-sqrt68.8%
pow268.8%
Applied egg-rr68.8%
Taylor expanded in l around 0 98.3%
Final simplification83.7%
l_m = (fabs.f64 l) l_s = (copysign.f64 1 l) (FPCore (l_s F l_m) :precision binary64 (* l_s (* PI l_m)))
l_m = fabs(l);
l_s = copysign(1.0, l);
double code(double l_s, double F, double l_m) {
return l_s * (((double) M_PI) * l_m);
}
l_m = Math.abs(l);
l_s = Math.copySign(1.0, l);
public static double code(double l_s, double F, double l_m) {
return l_s * (Math.PI * l_m);
}
l_m = math.fabs(l) l_s = math.copysign(1.0, l) def code(l_s, F, l_m): return l_s * (math.pi * l_m)
l_m = abs(l) l_s = copysign(1.0, l) function code(l_s, F, l_m) return Float64(l_s * Float64(pi * l_m)) end
l_m = abs(l); l_s = sign(l) * abs(1.0); function tmp = code(l_s, F, l_m) tmp = l_s * (pi * l_m); end
l_m = N[Abs[l], $MachinePrecision]
l_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[l]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[l$95$s_, F_, l$95$m_] := N[(l$95$s * N[(Pi * l$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
l_s = \mathsf{copysign}\left(1, \ell\right)
\\
l_s \cdot \left(\pi \cdot l_m\right)
\end{array}
Initial program 75.3%
fma-neg75.3%
distribute-lft-neg-in75.3%
sqr-neg75.3%
distribute-neg-frac75.3%
metadata-eval75.3%
distribute-lft-neg-out75.3%
neg-mul-175.3%
associate-/r*75.3%
metadata-eval75.3%
associate-*l/75.3%
*-lft-identity75.3%
associate-/l/79.9%
Simplified79.9%
add-sqr-sqrt40.2%
pow240.2%
Applied egg-rr40.2%
Taylor expanded in l around 0 78.8%
Final simplification78.8%
herbie shell --seed 2023322
(FPCore (F l)
:name "VandenBroeck and Keller, Equation (6)"
:precision binary64
(- (* PI l) (* (/ 1.0 (* F F)) (tan (* PI l)))))