
(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 7 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 #s(literal 1 binary64) l)
(FPCore (l_s F l_m)
:precision binary64
(*
l_s
(if (<= (* PI l_m) 0.1)
(+ (* PI l_m) (/ -1.0 (/ F (/ (tan (* PI 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) <= 0.1) {
tmp = (((double) M_PI) * l_m) + (-1.0 / (F / (tan((((double) M_PI) * 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) <= 0.1) {
tmp = (Math.PI * l_m) + (-1.0 / (F / (Math.tan((Math.PI * 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) <= 0.1: tmp = (math.pi * l_m) + (-1.0 / (F / (math.tan((math.pi * 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) <= 0.1) tmp = Float64(Float64(pi * l_m) + Float64(-1.0 / Float64(F / Float64(tan(Float64(pi * 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) <= 0.1) tmp = (pi * l_m) + (-1.0 / (F / (tan((pi * 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], 0.1], N[(N[(Pi * l$95$m), $MachinePrecision] + N[(-1.0 / N[(F / N[(N[Tan[N[(Pi * l$95$m), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision]), $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 0.1:\\
\;\;\;\;\pi \cdot l\_m + \frac{-1}{\frac{F}{\frac{\tan \left(\pi \cdot l\_m\right)}{F}}}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot l\_m\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 0.10000000000000001Initial program 79.9%
associate-*l/80.4%
*-un-lft-identity80.4%
associate-/r*85.6%
clear-num85.6%
Applied egg-rr85.6%
if 0.10000000000000001 < (*.f64 (PI.f64) l) Initial program 64.6%
associate-*l/64.6%
*-un-lft-identity64.6%
associate-/r*64.6%
add-sqr-sqrt25.0%
associate-/r*25.0%
Applied egg-rr25.0%
Taylor expanded in l around inf 99.7%
Final simplification89.0%
l\_m = (fabs.f64 l)
l\_s = (copysign.f64 #s(literal 1 binary64) l)
(FPCore (l_s F l_m)
:precision binary64
(*
l_s
(if (<= (* PI l_m) 0.1)
(- (* 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) <= 0.1) {
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) <= 0.1) {
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) <= 0.1: 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) <= 0.1) 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) <= 0.1) 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], 0.1], 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 0.1:\\
\;\;\;\;\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) < 0.10000000000000001Initial program 79.9%
associate-*l/80.4%
*-un-lft-identity80.4%
associate-/r*85.6%
Applied egg-rr85.6%
if 0.10000000000000001 < (*.f64 (PI.f64) l) Initial program 64.6%
associate-*l/64.6%
*-un-lft-identity64.6%
associate-/r*64.6%
add-sqr-sqrt25.0%
associate-/r*25.0%
Applied egg-rr25.0%
Taylor expanded in l around inf 99.7%
Final simplification88.9%
l\_m = (fabs.f64 l) l\_s = (copysign.f64 #s(literal 1 binary64) l) (FPCore (l_s F l_m) :precision binary64 (let* ((t_0 (+ (* PI l_m) (* l_m (/ PI F))))) (* l_s (if (<= (* PI l_m) 0.1) (- t_0 (/ t_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 t_0 = (((double) M_PI) * l_m) + (l_m * (((double) M_PI) / F));
double tmp;
if ((((double) M_PI) * l_m) <= 0.1) {
tmp = t_0 - (t_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 t_0 = (Math.PI * l_m) + (l_m * (Math.PI / F));
double tmp;
if ((Math.PI * l_m) <= 0.1) {
tmp = t_0 - (t_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): t_0 = (math.pi * l_m) + (l_m * (math.pi / F)) tmp = 0 if (math.pi * l_m) <= 0.1: tmp = t_0 - (t_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) t_0 = Float64(Float64(pi * l_m) + Float64(l_m * Float64(pi / F))) tmp = 0.0 if (Float64(pi * l_m) <= 0.1) tmp = Float64(t_0 - Float64(t_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) t_0 = (pi * l_m) + (l_m * (pi / F)); tmp = 0.0; if ((pi * l_m) <= 0.1) tmp = t_0 - (t_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_] := Block[{t$95$0 = N[(N[(Pi * l$95$m), $MachinePrecision] + N[(l$95$m * N[(Pi / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(l$95$s * If[LessEqual[N[(Pi * l$95$m), $MachinePrecision], 0.1], N[(t$95$0 - N[(t$95$0 / 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)
\\
\begin{array}{l}
t_0 := \pi \cdot l\_m + l\_m \cdot \frac{\pi}{F}\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;\pi \cdot l\_m \leq 0.1:\\
\;\;\;\;t\_0 - \frac{t\_0}{F}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot l\_m\\
\end{array}
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 0.10000000000000001Initial program 79.9%
*-commutative79.9%
sqr-neg79.9%
associate-*r/80.4%
sqr-neg80.4%
*-rgt-identity80.4%
Simplified80.4%
Taylor expanded in l around 0 75.9%
add-cbrt-cube75.6%
pow375.6%
Applied egg-rr75.6%
rem-cbrt-cube75.9%
*-commutative75.9%
add-sqr-sqrt30.2%
add-sqr-sqrt30.2%
difference-of-squares30.2%
sqrt-div30.2%
sqrt-prod16.4%
add-sqr-sqrt22.8%
sqrt-div22.8%
sqrt-prod17.8%
add-sqr-sqrt32.5%
Applied egg-rr32.5%
sub-neg32.5%
distribute-rgt-in32.5%
distribute-lft-in32.5%
rem-square-sqrt32.6%
associate-*r/32.6%
rem-square-sqrt32.6%
associate-*r/32.6%
distribute-neg-frac232.6%
Simplified81.1%
if 0.10000000000000001 < (*.f64 (PI.f64) l) Initial program 64.6%
associate-*l/64.6%
*-un-lft-identity64.6%
associate-/r*64.6%
add-sqr-sqrt25.0%
associate-/r*25.0%
Applied egg-rr25.0%
Taylor expanded in l around inf 99.7%
Final simplification85.5%
l\_m = (fabs.f64 l)
l\_s = (copysign.f64 #s(literal 1 binary64) l)
(FPCore (l_s F l_m)
:precision binary64
(*
l_s
(if (<= F 5.3e-300)
(* PI (* (/ l_m F) (/ -1.0 F)))
(if (or (<= F 1.2e-243) (not (<= F 1.1e-91)))
(* PI l_m)
(* (/ (* PI l_m) F) (/ -1.0 F))))))l\_m = fabs(l);
l\_s = copysign(1.0, l);
double code(double l_s, double F, double l_m) {
double tmp;
if (F <= 5.3e-300) {
tmp = ((double) M_PI) * ((l_m / F) * (-1.0 / F));
} else if ((F <= 1.2e-243) || !(F <= 1.1e-91)) {
tmp = ((double) M_PI) * l_m;
} else {
tmp = ((((double) M_PI) * l_m) / F) * (-1.0 / F);
}
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 (F <= 5.3e-300) {
tmp = Math.PI * ((l_m / F) * (-1.0 / F));
} else if ((F <= 1.2e-243) || !(F <= 1.1e-91)) {
tmp = Math.PI * l_m;
} else {
tmp = ((Math.PI * l_m) / F) * (-1.0 / F);
}
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 F <= 5.3e-300: tmp = math.pi * ((l_m / F) * (-1.0 / F)) elif (F <= 1.2e-243) or not (F <= 1.1e-91): tmp = math.pi * l_m else: tmp = ((math.pi * l_m) / F) * (-1.0 / F) 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 (F <= 5.3e-300) tmp = Float64(pi * Float64(Float64(l_m / F) * Float64(-1.0 / F))); elseif ((F <= 1.2e-243) || !(F <= 1.1e-91)) tmp = Float64(pi * l_m); else tmp = Float64(Float64(Float64(pi * l_m) / F) * Float64(-1.0 / F)); 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 (F <= 5.3e-300) tmp = pi * ((l_m / F) * (-1.0 / F)); elseif ((F <= 1.2e-243) || ~((F <= 1.1e-91))) tmp = pi * l_m; else tmp = ((pi * l_m) / F) * (-1.0 / F); 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[F, 5.3e-300], N[(Pi * N[(N[(l$95$m / F), $MachinePrecision] * N[(-1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[F, 1.2e-243], N[Not[LessEqual[F, 1.1e-91]], $MachinePrecision]], N[(Pi * l$95$m), $MachinePrecision], N[(N[(N[(Pi * l$95$m), $MachinePrecision] / F), $MachinePrecision] * N[(-1.0 / F), $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}\;F \leq 5.3 \cdot 10^{-300}:\\
\;\;\;\;\pi \cdot \left(\frac{l\_m}{F} \cdot \frac{-1}{F}\right)\\
\mathbf{elif}\;F \leq 1.2 \cdot 10^{-243} \lor \neg \left(F \leq 1.1 \cdot 10^{-91}\right):\\
\;\;\;\;\pi \cdot l\_m\\
\mathbf{else}:\\
\;\;\;\;\frac{\pi \cdot l\_m}{F} \cdot \frac{-1}{F}\\
\end{array}
\end{array}
if F < 5.2999999999999999e-300Initial program 73.5%
*-commutative73.5%
sqr-neg73.5%
associate-*r/73.8%
sqr-neg73.8%
*-rgt-identity73.8%
Simplified73.8%
Taylor expanded in l around 0 66.7%
add-exp-log31.7%
Applied egg-rr31.7%
Taylor expanded in F around 0 23.4%
mul-1-neg23.4%
*-commutative23.4%
associate-*r/23.5%
distribute-lft-neg-in23.5%
Simplified23.5%
*-un-lft-identity23.5%
pow223.5%
times-frac28.4%
Applied egg-rr28.4%
if 5.2999999999999999e-300 < F < 1.2e-243 or 1.1e-91 < F Initial program 84.4%
associate-*l/84.4%
*-un-lft-identity84.4%
associate-/r*84.4%
add-sqr-sqrt84.3%
associate-/r*84.3%
Applied egg-rr84.3%
Taylor expanded in l around inf 85.4%
if 1.2e-243 < F < 1.1e-91Initial program 63.5%
Taylor expanded in F around 0 63.0%
mul-1-neg63.0%
*-commutative63.0%
*-commutative63.0%
*-commutative63.0%
distribute-frac-neg263.0%
distribute-rgt-neg-out63.0%
*-commutative63.0%
*-commutative63.0%
distribute-lft-neg-out63.0%
distribute-rgt-neg-in63.0%
*-commutative63.0%
Simplified63.0%
pow263.0%
*-commutative63.0%
associate-/r*62.9%
add-sqr-sqrt0.0%
sqrt-unprod1.3%
sqr-neg1.3%
sqrt-unprod1.3%
*-commutative1.3%
add-sqr-sqrt1.3%
*-commutative1.3%
tan-quot1.3%
associate-/l/1.3%
Applied egg-rr74.3%
*-commutative74.3%
Simplified74.3%
Taylor expanded in l around 0 72.9%
Final simplification52.9%
l\_m = (fabs.f64 l)
l\_s = (copysign.f64 #s(literal 1 binary64) l)
(FPCore (l_s F l_m)
:precision binary64
(*
l_s
(if (or (<= F 1.6e-299) (and (not (<= F 3.6e-242)) (<= F 1.85e-91)))
(* 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 ((F <= 1.6e-299) || (!(F <= 3.6e-242) && (F <= 1.85e-91))) {
tmp = ((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 ((F <= 1.6e-299) || (!(F <= 3.6e-242) && (F <= 1.85e-91))) {
tmp = 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 (F <= 1.6e-299) or (not (F <= 3.6e-242) and (F <= 1.85e-91)): tmp = 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 ((F <= 1.6e-299) || (!(F <= 3.6e-242) && (F <= 1.85e-91))) tmp = Float64(pi * Float64(Float64(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 ((F <= 1.6e-299) || (~((F <= 3.6e-242)) && (F <= 1.85e-91))) tmp = 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[Or[LessEqual[F, 1.6e-299], And[N[Not[LessEqual[F, 3.6e-242]], $MachinePrecision], LessEqual[F, 1.85e-91]]], N[(Pi * N[(N[(l$95$m / 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}\;F \leq 1.6 \cdot 10^{-299} \lor \neg \left(F \leq 3.6 \cdot 10^{-242}\right) \land F \leq 1.85 \cdot 10^{-91}:\\
\;\;\;\;\pi \cdot \left(\frac{l\_m}{F} \cdot \frac{-1}{F}\right)\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot l\_m\\
\end{array}
\end{array}
if F < 1.60000000000000004e-299 or 3.60000000000000014e-242 < F < 1.8500000000000001e-91Initial program 71.9%
*-commutative71.9%
sqr-neg71.9%
associate-*r/72.5%
sqr-neg72.5%
*-rgt-identity72.5%
Simplified72.5%
Taylor expanded in l around 0 65.8%
add-exp-log31.5%
Applied egg-rr31.5%
Taylor expanded in F around 0 29.6%
mul-1-neg29.6%
*-commutative29.6%
associate-*r/29.7%
distribute-lft-neg-in29.7%
Simplified29.7%
*-un-lft-identity29.7%
pow229.7%
times-frac35.6%
Applied egg-rr35.6%
if 1.60000000000000004e-299 < F < 3.60000000000000014e-242 or 1.8500000000000001e-91 < F Initial program 84.4%
associate-*l/84.4%
*-un-lft-identity84.4%
associate-/r*84.4%
add-sqr-sqrt84.3%
associate-/r*84.3%
Applied egg-rr84.3%
Taylor expanded in l around inf 85.4%
Final simplification52.9%
l\_m = (fabs.f64 l) l\_s = (copysign.f64 #s(literal 1 binary64) l) (FPCore (l_s F l_m) :precision binary64 (* l_s (if (<= l_m 0.5) (- (* 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 (l_m <= 0.5) {
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 (l_m <= 0.5) {
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 l_m <= 0.5: 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 (l_m <= 0.5) 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 (l_m <= 0.5) 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[l$95$m, 0.5], 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}\;l\_m \leq 0.5:\\
\;\;\;\;\pi \cdot l\_m - \frac{\pi}{F} \cdot \frac{l\_m}{F}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot l\_m\\
\end{array}
\end{array}
if l < 0.5Initial program 79.9%
*-commutative79.9%
sqr-neg79.9%
associate-*r/80.4%
sqr-neg80.4%
*-rgt-identity80.4%
Simplified80.4%
Taylor expanded in l around 0 75.9%
*-commutative75.9%
times-frac81.1%
Applied egg-rr81.1%
if 0.5 < l Initial program 64.6%
associate-*l/64.6%
*-un-lft-identity64.6%
associate-/r*64.6%
add-sqr-sqrt25.0%
associate-/r*25.0%
Applied egg-rr25.0%
Taylor expanded in l around inf 99.7%
Final simplification85.5%
l\_m = (fabs.f64 l) l\_s = (copysign.f64 #s(literal 1 binary64) 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 76.2%
associate-*l/76.6%
*-un-lft-identity76.6%
associate-/r*80.6%
add-sqr-sqrt38.7%
associate-/r*38.7%
Applied egg-rr38.7%
Taylor expanded in l around inf 72.4%
Final simplification72.4%
herbie shell --seed 2024111
(FPCore (F l)
:name "VandenBroeck and Keller, Equation (6)"
:precision binary64
(- (* PI l) (* (/ 1.0 (* F F)) (tan (* PI l)))))