
(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}
NOTE: F should be positive before calling this function
(FPCore (F l)
:precision binary64
(let* ((t_0 (* (pow PI 3.0) 0.3333333333333333))
(t_1 (/ t_0 PI))
(t_2
(fma
(pow PI 3.0)
0.008333333333333333
(* (* PI -0.3333333333333333) t_1)))
(t_3 (* (pow PI 3.0) -0.16666666666666666))
(t_4 (fma (pow PI 3.0) 0.041666666666666664 t_3))
(t_5
(-
(* 0.008333333333333333 (pow PI 5.0))
(fma (pow PI 5.0) 0.041666666666666664 (* t_3 (pow PI 2.0))))))
(if (<= F 1.45e-158)
(- (* PI l) (/ (/ (tan (* l (pow (sqrt PI) 2.0))) F) F))
(+
(* PI l)
(/
-1.0
(*
(fma
l
(* PI -0.3333333333333333)
(fma
(pow l 3.0)
(- t_4 t_2)
(fma
(pow l 5.0)
(+
(-
(fma
-0.5
t_5
(fma
(* 0.041666666666666664 (pow PI 2.0))
t_0
(* (pow PI 5.0) -0.001388888888888889)))
(fma
(pow PI 5.0)
-0.0001984126984126984
(* t_5 (/ (* PI -0.3333333333333333) PI))))
(* t_1 (- t_2 t_4)))
(/ 1.0 (* PI l)))))
(/ F (/ 1.0 F))))))))F = abs(F);
double code(double F, double l) {
double t_0 = pow(((double) M_PI), 3.0) * 0.3333333333333333;
double t_1 = t_0 / ((double) M_PI);
double t_2 = fma(pow(((double) M_PI), 3.0), 0.008333333333333333, ((((double) M_PI) * -0.3333333333333333) * t_1));
double t_3 = pow(((double) M_PI), 3.0) * -0.16666666666666666;
double t_4 = fma(pow(((double) M_PI), 3.0), 0.041666666666666664, t_3);
double t_5 = (0.008333333333333333 * pow(((double) M_PI), 5.0)) - fma(pow(((double) M_PI), 5.0), 0.041666666666666664, (t_3 * pow(((double) M_PI), 2.0)));
double tmp;
if (F <= 1.45e-158) {
tmp = (((double) M_PI) * l) - ((tan((l * pow(sqrt(((double) M_PI)), 2.0))) / F) / F);
} else {
tmp = (((double) M_PI) * l) + (-1.0 / (fma(l, (((double) M_PI) * -0.3333333333333333), fma(pow(l, 3.0), (t_4 - t_2), fma(pow(l, 5.0), ((fma(-0.5, t_5, fma((0.041666666666666664 * pow(((double) M_PI), 2.0)), t_0, (pow(((double) M_PI), 5.0) * -0.001388888888888889))) - fma(pow(((double) M_PI), 5.0), -0.0001984126984126984, (t_5 * ((((double) M_PI) * -0.3333333333333333) / ((double) M_PI))))) + (t_1 * (t_2 - t_4))), (1.0 / (((double) M_PI) * l))))) * (F / (1.0 / F))));
}
return tmp;
}
F = abs(F) function code(F, l) t_0 = Float64((pi ^ 3.0) * 0.3333333333333333) t_1 = Float64(t_0 / pi) t_2 = fma((pi ^ 3.0), 0.008333333333333333, Float64(Float64(pi * -0.3333333333333333) * t_1)) t_3 = Float64((pi ^ 3.0) * -0.16666666666666666) t_4 = fma((pi ^ 3.0), 0.041666666666666664, t_3) t_5 = Float64(Float64(0.008333333333333333 * (pi ^ 5.0)) - fma((pi ^ 5.0), 0.041666666666666664, Float64(t_3 * (pi ^ 2.0)))) tmp = 0.0 if (F <= 1.45e-158) tmp = Float64(Float64(pi * l) - Float64(Float64(tan(Float64(l * (sqrt(pi) ^ 2.0))) / F) / F)); else tmp = Float64(Float64(pi * l) + Float64(-1.0 / Float64(fma(l, Float64(pi * -0.3333333333333333), fma((l ^ 3.0), Float64(t_4 - t_2), fma((l ^ 5.0), Float64(Float64(fma(-0.5, t_5, fma(Float64(0.041666666666666664 * (pi ^ 2.0)), t_0, Float64((pi ^ 5.0) * -0.001388888888888889))) - fma((pi ^ 5.0), -0.0001984126984126984, Float64(t_5 * Float64(Float64(pi * -0.3333333333333333) / pi)))) + Float64(t_1 * Float64(t_2 - t_4))), Float64(1.0 / Float64(pi * l))))) * Float64(F / Float64(1.0 / F))))); end return tmp end
NOTE: F should be positive before calling this function
code[F_, l_] := Block[{t$95$0 = N[(N[Power[Pi, 3.0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / Pi), $MachinePrecision]}, Block[{t$95$2 = N[(N[Power[Pi, 3.0], $MachinePrecision] * 0.008333333333333333 + N[(N[(Pi * -0.3333333333333333), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Power[Pi, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]}, Block[{t$95$4 = N[(N[Power[Pi, 3.0], $MachinePrecision] * 0.041666666666666664 + t$95$3), $MachinePrecision]}, Block[{t$95$5 = N[(N[(0.008333333333333333 * N[Power[Pi, 5.0], $MachinePrecision]), $MachinePrecision] - N[(N[Power[Pi, 5.0], $MachinePrecision] * 0.041666666666666664 + N[(t$95$3 * N[Power[Pi, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, 1.45e-158], N[(N[(Pi * l), $MachinePrecision] - N[(N[(N[Tan[N[(l * N[Power[N[Sqrt[Pi], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] + N[(-1.0 / N[(N[(l * N[(Pi * -0.3333333333333333), $MachinePrecision] + N[(N[Power[l, 3.0], $MachinePrecision] * N[(t$95$4 - t$95$2), $MachinePrecision] + N[(N[Power[l, 5.0], $MachinePrecision] * N[(N[(N[(-0.5 * t$95$5 + N[(N[(0.041666666666666664 * N[Power[Pi, 2.0], $MachinePrecision]), $MachinePrecision] * t$95$0 + N[(N[Power[Pi, 5.0], $MachinePrecision] * -0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Power[Pi, 5.0], $MachinePrecision] * -0.0001984126984126984 + N[(t$95$5 * N[(N[(Pi * -0.3333333333333333), $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 * N[(t$95$2 - t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(Pi * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(F / N[(1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
F = |F|\\
\\
\begin{array}{l}
t_0 := {\pi}^{3} \cdot 0.3333333333333333\\
t_1 := \frac{t_0}{\pi}\\
t_2 := \mathsf{fma}\left({\pi}^{3}, 0.008333333333333333, \left(\pi \cdot -0.3333333333333333\right) \cdot t_1\right)\\
t_3 := {\pi}^{3} \cdot -0.16666666666666666\\
t_4 := \mathsf{fma}\left({\pi}^{3}, 0.041666666666666664, t_3\right)\\
t_5 := 0.008333333333333333 \cdot {\pi}^{5} - \mathsf{fma}\left({\pi}^{5}, 0.041666666666666664, t_3 \cdot {\pi}^{2}\right)\\
\mathbf{if}\;F \leq 1.45 \cdot 10^{-158}:\\
\;\;\;\;\pi \cdot \ell - \frac{\frac{\tan \left(\ell \cdot {\left(\sqrt{\pi}\right)}^{2}\right)}{F}}{F}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell + \frac{-1}{\mathsf{fma}\left(\ell, \pi \cdot -0.3333333333333333, \mathsf{fma}\left({\ell}^{3}, t_4 - t_2, \mathsf{fma}\left({\ell}^{5}, \left(\mathsf{fma}\left(-0.5, t_5, \mathsf{fma}\left(0.041666666666666664 \cdot {\pi}^{2}, t_0, {\pi}^{5} \cdot -0.001388888888888889\right)\right) - \mathsf{fma}\left({\pi}^{5}, -0.0001984126984126984, t_5 \cdot \frac{\pi \cdot -0.3333333333333333}{\pi}\right)\right) + t_1 \cdot \left(t_2 - t_4\right), \frac{1}{\pi \cdot \ell}\right)\right)\right) \cdot \frac{F}{\frac{1}{F}}}\\
\end{array}
\end{array}
if F < 1.4499999999999999e-158Initial program 66.9%
associate-*l/67.7%
*-un-lft-identity67.7%
associate-/r*75.7%
Applied egg-rr75.7%
add-sqr-sqrt75.7%
pow275.7%
Applied egg-rr75.7%
if 1.4499999999999999e-158 < F Initial program 85.7%
associate-/r/85.8%
associate-/l*85.8%
clear-num85.8%
add-sqr-sqrt85.7%
sqrt-prod85.8%
sqr-neg85.8%
sqrt-unprod0.0%
add-sqr-sqrt68.2%
associate-/r*68.2%
clear-num68.2%
add-sqr-sqrt0.0%
sqrt-unprod85.8%
sqr-neg85.8%
sqrt-prod85.7%
add-sqr-sqrt85.8%
pow285.8%
Applied egg-rr85.8%
pow285.8%
associate-/l*85.8%
*-un-lft-identity85.8%
div-inv85.7%
times-frac85.7%
Applied egg-rr85.7%
Taylor expanded in l around 0 98.4%
Simplified98.4%
Final simplification83.3%
NOTE: F should be positive before calling this function
(FPCore (F l)
:precision binary64
(if (<= F 1.65e-158)
(- (* PI l) (/ (/ (tan (* l (pow (sqrt PI) 2.0))) F) F))
(+
(* PI l)
(/
-1.0
(*
(/ F (/ 1.0 F))
(fma
l
(* PI -0.3333333333333333)
(fma
(pow l 3.0)
(-
(fma
(pow PI 3.0)
0.041666666666666664
(* (pow PI 3.0) -0.16666666666666666))
(fma
(pow PI 3.0)
0.008333333333333333
(*
(* PI -0.3333333333333333)
(/ (* (pow PI 3.0) 0.3333333333333333) PI))))
(/ 1.0 (* PI l)))))))))F = abs(F);
double code(double F, double l) {
double tmp;
if (F <= 1.65e-158) {
tmp = (((double) M_PI) * l) - ((tan((l * pow(sqrt(((double) M_PI)), 2.0))) / F) / F);
} else {
tmp = (((double) M_PI) * l) + (-1.0 / ((F / (1.0 / F)) * fma(l, (((double) M_PI) * -0.3333333333333333), fma(pow(l, 3.0), (fma(pow(((double) M_PI), 3.0), 0.041666666666666664, (pow(((double) M_PI), 3.0) * -0.16666666666666666)) - fma(pow(((double) M_PI), 3.0), 0.008333333333333333, ((((double) M_PI) * -0.3333333333333333) * ((pow(((double) M_PI), 3.0) * 0.3333333333333333) / ((double) M_PI))))), (1.0 / (((double) M_PI) * l))))));
}
return tmp;
}
F = abs(F) function code(F, l) tmp = 0.0 if (F <= 1.65e-158) tmp = Float64(Float64(pi * l) - Float64(Float64(tan(Float64(l * (sqrt(pi) ^ 2.0))) / F) / F)); else tmp = Float64(Float64(pi * l) + Float64(-1.0 / Float64(Float64(F / Float64(1.0 / F)) * fma(l, Float64(pi * -0.3333333333333333), fma((l ^ 3.0), Float64(fma((pi ^ 3.0), 0.041666666666666664, Float64((pi ^ 3.0) * -0.16666666666666666)) - fma((pi ^ 3.0), 0.008333333333333333, Float64(Float64(pi * -0.3333333333333333) * Float64(Float64((pi ^ 3.0) * 0.3333333333333333) / pi)))), Float64(1.0 / Float64(pi * l))))))); end return tmp end
NOTE: F should be positive before calling this function code[F_, l_] := If[LessEqual[F, 1.65e-158], N[(N[(Pi * l), $MachinePrecision] - N[(N[(N[Tan[N[(l * N[Power[N[Sqrt[Pi], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] + N[(-1.0 / N[(N[(F / N[(1.0 / F), $MachinePrecision]), $MachinePrecision] * N[(l * N[(Pi * -0.3333333333333333), $MachinePrecision] + N[(N[Power[l, 3.0], $MachinePrecision] * N[(N[(N[Power[Pi, 3.0], $MachinePrecision] * 0.041666666666666664 + N[(N[Power[Pi, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] - N[(N[Power[Pi, 3.0], $MachinePrecision] * 0.008333333333333333 + N[(N[(Pi * -0.3333333333333333), $MachinePrecision] * N[(N[(N[Power[Pi, 3.0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(Pi * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
F = |F|\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq 1.65 \cdot 10^{-158}:\\
\;\;\;\;\pi \cdot \ell - \frac{\frac{\tan \left(\ell \cdot {\left(\sqrt{\pi}\right)}^{2}\right)}{F}}{F}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell + \frac{-1}{\frac{F}{\frac{1}{F}} \cdot \mathsf{fma}\left(\ell, \pi \cdot -0.3333333333333333, \mathsf{fma}\left({\ell}^{3}, \mathsf{fma}\left({\pi}^{3}, 0.041666666666666664, {\pi}^{3} \cdot -0.16666666666666666\right) - \mathsf{fma}\left({\pi}^{3}, 0.008333333333333333, \left(\pi \cdot -0.3333333333333333\right) \cdot \frac{{\pi}^{3} \cdot 0.3333333333333333}{\pi}\right), \frac{1}{\pi \cdot \ell}\right)\right)}\\
\end{array}
\end{array}
if F < 1.6500000000000001e-158Initial program 66.9%
associate-*l/67.7%
*-un-lft-identity67.7%
associate-/r*75.7%
Applied egg-rr75.7%
add-sqr-sqrt75.7%
pow275.7%
Applied egg-rr75.7%
if 1.6500000000000001e-158 < F Initial program 85.7%
associate-/r/85.8%
associate-/l*85.8%
clear-num85.8%
add-sqr-sqrt85.7%
sqrt-prod85.8%
sqr-neg85.8%
sqrt-unprod0.0%
add-sqr-sqrt68.2%
associate-/r*68.2%
clear-num68.2%
add-sqr-sqrt0.0%
sqrt-unprod85.8%
sqr-neg85.8%
sqrt-prod85.7%
add-sqr-sqrt85.8%
pow285.8%
Applied egg-rr85.8%
pow285.8%
associate-/l*85.8%
*-un-lft-identity85.8%
div-inv85.7%
times-frac85.7%
Applied egg-rr85.7%
Taylor expanded in l around 0 98.4%
fma-def98.4%
distribute-rgt-out--98.4%
metadata-eval98.4%
fma-def98.4%
Simplified98.4%
Final simplification83.3%
NOTE: F should be positive before calling this function
(FPCore (F l)
:precision binary64
(if (<= (/ 1.0 (* F F)) 2e+298)
(+
(* PI l)
(/
-1.0
(* (/ F (/ 1.0 F)) (fma l (* PI -0.3333333333333333) (/ 1.0 (* PI l))))))
(- (* PI l) (/ (/ (tan (* l (pow (sqrt PI) 2.0))) F) F))))F = abs(F);
double code(double F, double l) {
double tmp;
if ((1.0 / (F * F)) <= 2e+298) {
tmp = (((double) M_PI) * l) + (-1.0 / ((F / (1.0 / F)) * fma(l, (((double) M_PI) * -0.3333333333333333), (1.0 / (((double) M_PI) * l)))));
} else {
tmp = (((double) M_PI) * l) - ((tan((l * pow(sqrt(((double) M_PI)), 2.0))) / F) / F);
}
return tmp;
}
F = abs(F) function code(F, l) tmp = 0.0 if (Float64(1.0 / Float64(F * F)) <= 2e+298) tmp = Float64(Float64(pi * l) + Float64(-1.0 / Float64(Float64(F / Float64(1.0 / F)) * fma(l, Float64(pi * -0.3333333333333333), Float64(1.0 / Float64(pi * l)))))); else tmp = Float64(Float64(pi * l) - Float64(Float64(tan(Float64(l * (sqrt(pi) ^ 2.0))) / F) / F)); end return tmp end
NOTE: F should be positive before calling this function code[F_, l_] := If[LessEqual[N[(1.0 / N[(F * F), $MachinePrecision]), $MachinePrecision], 2e+298], N[(N[(Pi * l), $MachinePrecision] + N[(-1.0 / N[(N[(F / N[(1.0 / F), $MachinePrecision]), $MachinePrecision] * N[(l * N[(Pi * -0.3333333333333333), $MachinePrecision] + N[(1.0 / N[(Pi * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] - N[(N[(N[Tan[N[(l * N[Power[N[Sqrt[Pi], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
F = |F|\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{F \cdot F} \leq 2 \cdot 10^{+298}:\\
\;\;\;\;\pi \cdot \ell + \frac{-1}{\frac{F}{\frac{1}{F}} \cdot \mathsf{fma}\left(\ell, \pi \cdot -0.3333333333333333, \frac{1}{\pi \cdot \ell}\right)}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell - \frac{\frac{\tan \left(\ell \cdot {\left(\sqrt{\pi}\right)}^{2}\right)}{F}}{F}\\
\end{array}
\end{array}
if (/.f64 1 (*.f64 F F)) < 1.9999999999999999e298Initial program 89.7%
associate-/r/89.7%
associate-/l*89.7%
clear-num89.7%
add-sqr-sqrt39.4%
sqrt-prod82.6%
sqr-neg82.6%
sqrt-unprod43.2%
add-sqr-sqrt74.6%
associate-/r*74.6%
clear-num74.6%
add-sqr-sqrt43.2%
sqrt-unprod82.6%
sqr-neg82.6%
sqrt-prod39.4%
add-sqr-sqrt89.7%
pow289.7%
Applied egg-rr89.7%
pow289.7%
associate-/l*89.7%
*-un-lft-identity89.7%
div-inv89.7%
times-frac89.7%
Applied egg-rr89.7%
Taylor expanded in l around 0 96.5%
fma-def96.5%
distribute-rgt-out--96.5%
metadata-eval96.5%
Simplified96.5%
if 1.9999999999999999e298 < (/.f64 1 (*.f64 F F)) Initial program 28.6%
associate-*l/30.6%
*-un-lft-identity30.6%
associate-/r*50.3%
Applied egg-rr50.3%
add-sqr-sqrt50.5%
pow250.5%
Applied egg-rr50.5%
Final simplification84.1%
NOTE: F should be positive before calling this function
(FPCore (F l)
:precision binary64
(if (<= (/ 1.0 (* F F)) 2e+298)
(+
(* PI l)
(/
-1.0
(* (/ F (/ 1.0 F)) (fma l (* PI -0.3333333333333333) (/ 1.0 (* PI l))))))
(- (* PI l) (/ 1.0 (/ F (/ (tan (* PI l)) F))))))F = abs(F);
double code(double F, double l) {
double tmp;
if ((1.0 / (F * F)) <= 2e+298) {
tmp = (((double) M_PI) * l) + (-1.0 / ((F / (1.0 / F)) * fma(l, (((double) M_PI) * -0.3333333333333333), (1.0 / (((double) M_PI) * l)))));
} else {
tmp = (((double) M_PI) * l) - (1.0 / (F / (tan((((double) M_PI) * l)) / F)));
}
return tmp;
}
F = abs(F) function code(F, l) tmp = 0.0 if (Float64(1.0 / Float64(F * F)) <= 2e+298) tmp = Float64(Float64(pi * l) + Float64(-1.0 / Float64(Float64(F / Float64(1.0 / F)) * fma(l, Float64(pi * -0.3333333333333333), Float64(1.0 / Float64(pi * l)))))); else tmp = Float64(Float64(pi * l) - Float64(1.0 / Float64(F / Float64(tan(Float64(pi * l)) / F)))); end return tmp end
NOTE: F should be positive before calling this function code[F_, l_] := If[LessEqual[N[(1.0 / N[(F * F), $MachinePrecision]), $MachinePrecision], 2e+298], N[(N[(Pi * l), $MachinePrecision] + N[(-1.0 / N[(N[(F / N[(1.0 / F), $MachinePrecision]), $MachinePrecision] * N[(l * N[(Pi * -0.3333333333333333), $MachinePrecision] + N[(1.0 / N[(Pi * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] - N[(1.0 / N[(F / N[(N[Tan[N[(Pi * l), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
F = |F|\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{F \cdot F} \leq 2 \cdot 10^{+298}:\\
\;\;\;\;\pi \cdot \ell + \frac{-1}{\frac{F}{\frac{1}{F}} \cdot \mathsf{fma}\left(\ell, \pi \cdot -0.3333333333333333, \frac{1}{\pi \cdot \ell}\right)}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell - \frac{1}{\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}}\\
\end{array}
\end{array}
if (/.f64 1 (*.f64 F F)) < 1.9999999999999999e298Initial program 89.7%
associate-/r/89.7%
associate-/l*89.7%
clear-num89.7%
add-sqr-sqrt39.4%
sqrt-prod82.6%
sqr-neg82.6%
sqrt-unprod43.2%
add-sqr-sqrt74.6%
associate-/r*74.6%
clear-num74.6%
add-sqr-sqrt43.2%
sqrt-unprod82.6%
sqr-neg82.6%
sqrt-prod39.4%
add-sqr-sqrt89.7%
pow289.7%
Applied egg-rr89.7%
pow289.7%
associate-/l*89.7%
*-un-lft-identity89.7%
div-inv89.7%
times-frac89.7%
Applied egg-rr89.7%
Taylor expanded in l around 0 96.5%
fma-def96.5%
distribute-rgt-out--96.5%
metadata-eval96.5%
Simplified96.5%
if 1.9999999999999999e298 < (/.f64 1 (*.f64 F F)) Initial program 28.6%
associate-/r/30.6%
associate-/l*50.3%
clear-num50.3%
add-sqr-sqrt23.7%
sqrt-prod18.2%
sqr-neg18.2%
sqrt-unprod0.9%
add-sqr-sqrt1.7%
associate-/r*1.7%
clear-num1.7%
add-sqr-sqrt0.8%
sqrt-unprod18.2%
sqr-neg18.2%
sqrt-prod17.4%
add-sqr-sqrt30.6%
pow230.6%
Applied egg-rr30.6%
pow230.6%
associate-/l*50.3%
*-un-lft-identity50.3%
div-inv50.2%
times-frac30.6%
Applied egg-rr30.6%
frac-times50.2%
*-un-lft-identity50.2%
un-div-inv50.3%
Applied egg-rr50.3%
Final simplification84.0%
NOTE: F should be positive before calling this function (FPCore (F l) :precision binary64 (if (<= (* F F) 4e-316) (- (* PI l) (/ PI (/ F (/ l F)))) (- (* PI l) (/ (tan (* PI l)) (* F F)))))
F = abs(F);
double code(double F, double l) {
double tmp;
if ((F * F) <= 4e-316) {
tmp = (((double) M_PI) * l) - (((double) M_PI) / (F / (l / F)));
} else {
tmp = (((double) M_PI) * l) - (tan((((double) M_PI) * l)) / (F * F));
}
return tmp;
}
F = Math.abs(F);
public static double code(double F, double l) {
double tmp;
if ((F * F) <= 4e-316) {
tmp = (Math.PI * l) - (Math.PI / (F / (l / F)));
} else {
tmp = (Math.PI * l) - (Math.tan((Math.PI * l)) / (F * F));
}
return tmp;
}
F = abs(F) def code(F, l): tmp = 0 if (F * F) <= 4e-316: tmp = (math.pi * l) - (math.pi / (F / (l / F))) else: tmp = (math.pi * l) - (math.tan((math.pi * l)) / (F * F)) return tmp
F = abs(F) function code(F, l) tmp = 0.0 if (Float64(F * F) <= 4e-316) tmp = Float64(Float64(pi * l) - Float64(pi / Float64(F / Float64(l / F)))); else tmp = Float64(Float64(pi * l) - Float64(tan(Float64(pi * l)) / Float64(F * F))); end return tmp end
F = abs(F) function tmp_2 = code(F, l) tmp = 0.0; if ((F * F) <= 4e-316) tmp = (pi * l) - (pi / (F / (l / F))); else tmp = (pi * l) - (tan((pi * l)) / (F * F)); end tmp_2 = tmp; end
NOTE: F should be positive before calling this function code[F_, l_] := If[LessEqual[N[(F * F), $MachinePrecision], 4e-316], N[(N[(Pi * l), $MachinePrecision] - N[(Pi / N[(F / N[(l / F), $MachinePrecision]), $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}
F = |F|\\
\\
\begin{array}{l}
\mathbf{if}\;F \cdot F \leq 4 \cdot 10^{-316}:\\
\;\;\;\;\pi \cdot \ell - \frac{\pi}{\frac{F}{\frac{\ell}{F}}}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell - \frac{\tan \left(\pi \cdot \ell\right)}{F \cdot F}\\
\end{array}
\end{array}
if (*.f64 F F) < 3.999999984e-316Initial program 27.6%
sqr-neg27.6%
associate-*l/29.6%
*-lft-identity29.6%
sqr-neg29.6%
Simplified29.6%
Taylor expanded in l around 0 28.5%
*-commutative28.5%
times-frac48.5%
Applied egg-rr48.5%
associate-*l/48.4%
associate-/l*48.6%
Applied egg-rr48.6%
if 3.999999984e-316 < (*.f64 F F) Initial program 89.8%
sqr-neg89.8%
associate-*l/89.8%
*-lft-identity89.8%
sqr-neg89.8%
Simplified89.8%
Final simplification78.8%
NOTE: F should be positive before calling this function (FPCore (F l) :precision binary64 (- (* PI l) (/ (/ (tan (* PI l)) F) F)))
F = abs(F);
double code(double F, double l) {
return (((double) M_PI) * l) - ((tan((((double) M_PI) * l)) / F) / F);
}
F = Math.abs(F);
public static double code(double F, double l) {
return (Math.PI * l) - ((Math.tan((Math.PI * l)) / F) / F);
}
F = abs(F) def code(F, l): return (math.pi * l) - ((math.tan((math.pi * l)) / F) / F)
F = abs(F) function code(F, l) return Float64(Float64(pi * l) - Float64(Float64(tan(Float64(pi * l)) / F) / F)) end
F = abs(F) function tmp = code(F, l) tmp = (pi * l) - ((tan((pi * l)) / F) / F); end
NOTE: F should be positive before calling this function 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}
F = |F|\\
\\
\pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}
\end{array}
Initial program 73.2%
associate-*l/73.8%
*-un-lft-identity73.8%
associate-/r*79.1%
Applied egg-rr79.1%
Final simplification79.1%
NOTE: F should be positive before calling this function (FPCore (F l) :precision binary64 (fma PI l (/ (/ (* PI l) (- F)) F)))
F = abs(F);
double code(double F, double l) {
return fma(((double) M_PI), l, (((((double) M_PI) * l) / -F) / F));
}
F = abs(F) function code(F, l) return fma(pi, l, Float64(Float64(Float64(pi * l) / Float64(-F)) / F)) end
NOTE: F should be positive before calling this function code[F_, l_] := N[(Pi * l + N[(N[(N[(Pi * l), $MachinePrecision] / (-F)), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
F = |F|\\
\\
\mathsf{fma}\left(\pi, \ell, \frac{\frac{\pi \cdot \ell}{-F}}{F}\right)
\end{array}
Initial program 73.2%
*-commutative73.2%
sqr-neg73.2%
*-commutative73.2%
fma-neg73.2%
associate-*l/73.8%
times-frac79.1%
distribute-lft-neg-in79.1%
neg-mul-179.1%
associate-/r*79.1%
metadata-eval79.1%
distribute-neg-frac79.1%
metadata-eval79.1%
times-frac73.8%
Simplified79.1%
Taylor expanded in l around 0 73.4%
Final simplification73.4%
NOTE: F should be positive before calling this function (FPCore (F l) :precision binary64 (- (* PI l) (* (/ l F) (/ PI F))))
F = abs(F);
double code(double F, double l) {
return (((double) M_PI) * l) - ((l / F) * (((double) M_PI) / F));
}
F = Math.abs(F);
public static double code(double F, double l) {
return (Math.PI * l) - ((l / F) * (Math.PI / F));
}
F = abs(F) def code(F, l): return (math.pi * l) - ((l / F) * (math.pi / F))
F = abs(F) function code(F, l) return Float64(Float64(pi * l) - Float64(Float64(l / F) * Float64(pi / F))) end
F = abs(F) function tmp = code(F, l) tmp = (pi * l) - ((l / F) * (pi / F)); end
NOTE: F should be positive before calling this function code[F_, l_] := N[(N[(Pi * l), $MachinePrecision] - N[(N[(l / F), $MachinePrecision] * N[(Pi / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
F = |F|\\
\\
\pi \cdot \ell - \frac{\ell}{F} \cdot \frac{\pi}{F}
\end{array}
Initial program 73.2%
sqr-neg73.2%
associate-*l/73.8%
*-lft-identity73.8%
sqr-neg73.8%
Simplified73.8%
Taylor expanded in l around 0 68.1%
*-commutative68.1%
times-frac73.4%
Applied egg-rr73.4%
Final simplification73.4%
NOTE: F should be positive before calling this function (FPCore (F l) :precision binary64 (- (* PI l) (/ (/ (* PI l) F) F)))
F = abs(F);
double code(double F, double l) {
return (((double) M_PI) * l) - (((((double) M_PI) * l) / F) / F);
}
F = Math.abs(F);
public static double code(double F, double l) {
return (Math.PI * l) - (((Math.PI * l) / F) / F);
}
F = abs(F) def code(F, l): return (math.pi * l) - (((math.pi * l) / F) / F)
F = abs(F) function code(F, l) return Float64(Float64(pi * l) - Float64(Float64(Float64(pi * l) / F) / F)) end
F = abs(F) function tmp = code(F, l) tmp = (pi * l) - (((pi * l) / F) / F); end
NOTE: F should be positive before calling this function code[F_, l_] := N[(N[(Pi * l), $MachinePrecision] - N[(N[(N[(Pi * l), $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
F = |F|\\
\\
\pi \cdot \ell - \frac{\frac{\pi \cdot \ell}{F}}{F}
\end{array}
Initial program 73.2%
associate-*l/73.8%
*-un-lft-identity73.8%
associate-/r*79.1%
Applied egg-rr79.1%
Taylor expanded in l around 0 73.4%
Final simplification73.4%
NOTE: F should be positive before calling this function (FPCore (F l) :precision binary64 (/ (- PI) (* F (/ F l))))
F = abs(F);
double code(double F, double l) {
return -((double) M_PI) / (F * (F / l));
}
F = Math.abs(F);
public static double code(double F, double l) {
return -Math.PI / (F * (F / l));
}
F = abs(F) def code(F, l): return -math.pi / (F * (F / l))
F = abs(F) function code(F, l) return Float64(Float64(-pi) / Float64(F * Float64(F / l))) end
F = abs(F) function tmp = code(F, l) tmp = -pi / (F * (F / l)); end
NOTE: F should be positive before calling this function code[F_, l_] := N[((-Pi) / N[(F * N[(F / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
F = |F|\\
\\
\frac{-\pi}{F \cdot \frac{F}{\ell}}
\end{array}
Initial program 73.2%
sqr-neg73.2%
associate-*l/73.8%
*-lft-identity73.8%
sqr-neg73.8%
Simplified73.8%
Taylor expanded in l around 0 68.1%
*-commutative68.1%
times-frac73.4%
Applied egg-rr73.4%
Taylor expanded in F around 0 21.0%
mul-1-neg21.0%
*-commutative21.0%
associate-/l*20.9%
Simplified20.9%
unpow220.9%
*-un-lft-identity20.9%
times-frac26.2%
/-rgt-identity26.2%
Applied egg-rr26.2%
Final simplification26.2%
herbie shell --seed 2023313
(FPCore (F l)
:name "VandenBroeck and Keller, Equation (6)"
:precision binary64
(- (* PI l) (* (/ 1.0 (* F F)) (tan (* PI l)))))