
(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 12 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
(let* ((t_0 (* 0.008333333333333333 (pow PI 5.0)))
(t_1 (* (pow PI 3.0) 0.3333333333333333))
(t_2
(fma (pow PI 5.0) 0.041666666666666664 (* (* -0.5 (pow PI 2.0)) t_1)))
(t_3 (- t_2 t_0))
(t_4 (* (pow F 2.0) (/ t_3 (pow PI 2.0))))
(t_5
(* (pow F 2.0) (/ (* (pow PI 6.0) 0.1111111111111111) (pow PI 3.0)))))
(if (<= (* F F) 1e-320)
(- (* PI l) (/ (/ (tan (* l (cbrt (pow PI 3.0)))) F) F))
(if (<= (* F F) 1e-54)
(+
(* PI l)
(/
-1.0
(/
(fma
(pow l 2.0)
(fma
(pow l 2.0)
(+
(fma
(- (pow l 2.0))
(+
(+
(*
(pow F 2.0)
(/
(-
(* -0.0001984126984126984 (pow PI 7.0))
(fma
-0.5
(* (pow PI 2.0) (- t_0 t_2))
(fma
(* 0.041666666666666664 (pow PI 4.0))
t_1
(* (pow PI 7.0) -0.001388888888888889))))
(pow PI 2.0)))
(* (pow F 2.0) (/ (* t_1 t_3) (pow PI 3.0))))
(* (* (pow PI 3.0) (/ 0.3333333333333333 PI)) (+ t_5 t_4)))
t_5)
t_4)
(*
(pow F 2.0)
(* (pow PI 3.0) (/ 0.3333333333333333 (- (pow PI 2.0))))))
(/ (pow F 2.0) PI))
l)))
(- (* PI l) (/ 1.0 (/ F (/ (tan (* PI l)) F))))))))
double code(double F, double l) {
double t_0 = 0.008333333333333333 * pow(((double) M_PI), 5.0);
double t_1 = pow(((double) M_PI), 3.0) * 0.3333333333333333;
double t_2 = fma(pow(((double) M_PI), 5.0), 0.041666666666666664, ((-0.5 * pow(((double) M_PI), 2.0)) * t_1));
double t_3 = t_2 - t_0;
double t_4 = pow(F, 2.0) * (t_3 / pow(((double) M_PI), 2.0));
double t_5 = pow(F, 2.0) * ((pow(((double) M_PI), 6.0) * 0.1111111111111111) / pow(((double) M_PI), 3.0));
double tmp;
if ((F * F) <= 1e-320) {
tmp = (((double) M_PI) * l) - ((tan((l * cbrt(pow(((double) M_PI), 3.0)))) / F) / F);
} else if ((F * F) <= 1e-54) {
tmp = (((double) M_PI) * l) + (-1.0 / (fma(pow(l, 2.0), fma(pow(l, 2.0), (fma(-pow(l, 2.0), (((pow(F, 2.0) * (((-0.0001984126984126984 * pow(((double) M_PI), 7.0)) - fma(-0.5, (pow(((double) M_PI), 2.0) * (t_0 - t_2)), fma((0.041666666666666664 * pow(((double) M_PI), 4.0)), t_1, (pow(((double) M_PI), 7.0) * -0.001388888888888889)))) / pow(((double) M_PI), 2.0))) + (pow(F, 2.0) * ((t_1 * t_3) / pow(((double) M_PI), 3.0)))) + ((pow(((double) M_PI), 3.0) * (0.3333333333333333 / ((double) M_PI))) * (t_5 + t_4))), t_5) + t_4), (pow(F, 2.0) * (pow(((double) M_PI), 3.0) * (0.3333333333333333 / -pow(((double) M_PI), 2.0))))), (pow(F, 2.0) / ((double) M_PI))) / l));
} else {
tmp = (((double) M_PI) * l) - (1.0 / (F / (tan((((double) M_PI) * l)) / F)));
}
return tmp;
}
function code(F, l) t_0 = Float64(0.008333333333333333 * (pi ^ 5.0)) t_1 = Float64((pi ^ 3.0) * 0.3333333333333333) t_2 = fma((pi ^ 5.0), 0.041666666666666664, Float64(Float64(-0.5 * (pi ^ 2.0)) * t_1)) t_3 = Float64(t_2 - t_0) t_4 = Float64((F ^ 2.0) * Float64(t_3 / (pi ^ 2.0))) t_5 = Float64((F ^ 2.0) * Float64(Float64((pi ^ 6.0) * 0.1111111111111111) / (pi ^ 3.0))) tmp = 0.0 if (Float64(F * F) <= 1e-320) tmp = Float64(Float64(pi * l) - Float64(Float64(tan(Float64(l * cbrt((pi ^ 3.0)))) / F) / F)); elseif (Float64(F * F) <= 1e-54) tmp = Float64(Float64(pi * l) + Float64(-1.0 / Float64(fma((l ^ 2.0), fma((l ^ 2.0), Float64(fma(Float64(-(l ^ 2.0)), Float64(Float64(Float64((F ^ 2.0) * Float64(Float64(Float64(-0.0001984126984126984 * (pi ^ 7.0)) - fma(-0.5, Float64((pi ^ 2.0) * Float64(t_0 - t_2)), fma(Float64(0.041666666666666664 * (pi ^ 4.0)), t_1, Float64((pi ^ 7.0) * -0.001388888888888889)))) / (pi ^ 2.0))) + Float64((F ^ 2.0) * Float64(Float64(t_1 * t_3) / (pi ^ 3.0)))) + Float64(Float64((pi ^ 3.0) * Float64(0.3333333333333333 / pi)) * Float64(t_5 + t_4))), t_5) + t_4), Float64((F ^ 2.0) * Float64((pi ^ 3.0) * Float64(0.3333333333333333 / Float64(-(pi ^ 2.0)))))), Float64((F ^ 2.0) / pi)) / l))); else tmp = Float64(Float64(pi * l) - Float64(1.0 / Float64(F / Float64(tan(Float64(pi * l)) / F)))); end return tmp end
code[F_, l_] := Block[{t$95$0 = N[(0.008333333333333333 * N[Power[Pi, 5.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[Pi, 3.0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]}, Block[{t$95$2 = N[(N[Power[Pi, 5.0], $MachinePrecision] * 0.041666666666666664 + N[(N[(-0.5 * N[Power[Pi, 2.0], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 - t$95$0), $MachinePrecision]}, Block[{t$95$4 = N[(N[Power[F, 2.0], $MachinePrecision] * N[(t$95$3 / N[Power[Pi, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[Power[F, 2.0], $MachinePrecision] * N[(N[(N[Power[Pi, 6.0], $MachinePrecision] * 0.1111111111111111), $MachinePrecision] / N[Power[Pi, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(F * F), $MachinePrecision], 1e-320], N[(N[(Pi * l), $MachinePrecision] - N[(N[(N[Tan[N[(l * N[Power[N[Power[Pi, 3.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(F * F), $MachinePrecision], 1e-54], N[(N[(Pi * l), $MachinePrecision] + N[(-1.0 / N[(N[(N[Power[l, 2.0], $MachinePrecision] * N[(N[Power[l, 2.0], $MachinePrecision] * N[(N[((-N[Power[l, 2.0], $MachinePrecision]) * N[(N[(N[(N[Power[F, 2.0], $MachinePrecision] * N[(N[(N[(-0.0001984126984126984 * N[Power[Pi, 7.0], $MachinePrecision]), $MachinePrecision] - N[(-0.5 * N[(N[Power[Pi, 2.0], $MachinePrecision] * N[(t$95$0 - t$95$2), $MachinePrecision]), $MachinePrecision] + N[(N[(0.041666666666666664 * N[Power[Pi, 4.0], $MachinePrecision]), $MachinePrecision] * t$95$1 + N[(N[Power[Pi, 7.0], $MachinePrecision] * -0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[Pi, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[F, 2.0], $MachinePrecision] * N[(N[(t$95$1 * t$95$3), $MachinePrecision] / N[Power[Pi, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Power[Pi, 3.0], $MachinePrecision] * N[(0.3333333333333333 / Pi), $MachinePrecision]), $MachinePrecision] * N[(t$95$5 + t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$5), $MachinePrecision] + t$95$4), $MachinePrecision] + N[(N[Power[F, 2.0], $MachinePrecision] * N[(N[Power[Pi, 3.0], $MachinePrecision] * N[(0.3333333333333333 / (-N[Power[Pi, 2.0], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[F, 2.0], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision] / l), $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}
\\
\begin{array}{l}
t_0 := 0.008333333333333333 \cdot {\pi}^{5}\\
t_1 := {\pi}^{3} \cdot 0.3333333333333333\\
t_2 := \mathsf{fma}\left({\pi}^{5}, 0.041666666666666664, \left(-0.5 \cdot {\pi}^{2}\right) \cdot t\_1\right)\\
t_3 := t\_2 - t\_0\\
t_4 := {F}^{2} \cdot \frac{t\_3}{{\pi}^{2}}\\
t_5 := {F}^{2} \cdot \frac{{\pi}^{6} \cdot 0.1111111111111111}{{\pi}^{3}}\\
\mathbf{if}\;F \cdot F \leq 10^{-320}:\\
\;\;\;\;\pi \cdot \ell - \frac{\frac{\tan \left(\ell \cdot \sqrt[3]{{\pi}^{3}}\right)}{F}}{F}\\
\mathbf{elif}\;F \cdot F \leq 10^{-54}:\\
\;\;\;\;\pi \cdot \ell + \frac{-1}{\frac{\mathsf{fma}\left({\ell}^{2}, \mathsf{fma}\left({\ell}^{2}, \mathsf{fma}\left(-{\ell}^{2}, \left({F}^{2} \cdot \frac{-0.0001984126984126984 \cdot {\pi}^{7} - \mathsf{fma}\left(-0.5, {\pi}^{2} \cdot \left(t\_0 - t\_2\right), \mathsf{fma}\left(0.041666666666666664 \cdot {\pi}^{4}, t\_1, {\pi}^{7} \cdot -0.001388888888888889\right)\right)}{{\pi}^{2}} + {F}^{2} \cdot \frac{t\_1 \cdot t\_3}{{\pi}^{3}}\right) + \left({\pi}^{3} \cdot \frac{0.3333333333333333}{\pi}\right) \cdot \left(t\_5 + t\_4\right), t\_5\right) + t\_4, {F}^{2} \cdot \left({\pi}^{3} \cdot \frac{0.3333333333333333}{-{\pi}^{2}}\right)\right), \frac{{F}^{2}}{\pi}\right)}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell - \frac{1}{\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}}\\
\end{array}
\end{array}
if (*.f64 F F) < 9.99989e-321Initial program 30.6%
associate-*l/31.2%
*-un-lft-identity31.2%
associate-/r*59.8%
Applied egg-rr59.8%
add-cbrt-cube60.3%
pow360.3%
Applied egg-rr60.3%
if 9.99989e-321 < (*.f64 F F) < 1e-54Initial program 67.2%
associate-*l/68.8%
*-un-lft-identity68.8%
associate-/r*68.9%
clear-num68.9%
Applied egg-rr68.9%
Taylor expanded in l around 0 95.2%
Simplified95.2%
if 1e-54 < (*.f64 F F) Initial program 99.2%
associate-*l/99.2%
*-un-lft-identity99.2%
associate-/r*99.2%
clear-num99.2%
Applied egg-rr99.2%
Final simplification89.1%
(FPCore (F l)
:precision binary64
(if (<= (* F F) 1e-320)
(- (* PI l) (/ (/ (tan (* l (cbrt (pow PI 3.0)))) F) F))
(if (<= (* F F) 1e-54)
(-
(* PI l)
(/
1.0
(/
(fma
(pow l 2.0)
(fma
(- (pow l 2.0))
(-
(*
(pow F 2.0)
(/
(-
(* 0.008333333333333333 (pow PI 5.0))
(fma
(pow PI 5.0)
0.041666666666666664
(* (* -0.5 (pow PI 2.0)) (* (pow PI 3.0) 0.3333333333333333))))
(pow PI 2.0)))
(*
(pow F 2.0)
(/ (* (pow PI 6.0) 0.1111111111111111) (pow PI 3.0))))
(*
(pow F 2.0)
(* (pow PI 3.0) (/ 0.3333333333333333 (- (pow PI 2.0))))))
(/ (pow F 2.0) PI))
l)))
(- (* PI l) (/ 1.0 (/ F (/ (tan (* PI l)) F)))))))
double code(double F, double l) {
double tmp;
if ((F * F) <= 1e-320) {
tmp = (((double) M_PI) * l) - ((tan((l * cbrt(pow(((double) M_PI), 3.0)))) / F) / F);
} else if ((F * F) <= 1e-54) {
tmp = (((double) M_PI) * l) - (1.0 / (fma(pow(l, 2.0), fma(-pow(l, 2.0), ((pow(F, 2.0) * (((0.008333333333333333 * pow(((double) M_PI), 5.0)) - fma(pow(((double) M_PI), 5.0), 0.041666666666666664, ((-0.5 * pow(((double) M_PI), 2.0)) * (pow(((double) M_PI), 3.0) * 0.3333333333333333)))) / pow(((double) M_PI), 2.0))) - (pow(F, 2.0) * ((pow(((double) M_PI), 6.0) * 0.1111111111111111) / pow(((double) M_PI), 3.0)))), (pow(F, 2.0) * (pow(((double) M_PI), 3.0) * (0.3333333333333333 / -pow(((double) M_PI), 2.0))))), (pow(F, 2.0) / ((double) M_PI))) / l));
} else {
tmp = (((double) M_PI) * l) - (1.0 / (F / (tan((((double) M_PI) * l)) / F)));
}
return tmp;
}
function code(F, l) tmp = 0.0 if (Float64(F * F) <= 1e-320) tmp = Float64(Float64(pi * l) - Float64(Float64(tan(Float64(l * cbrt((pi ^ 3.0)))) / F) / F)); elseif (Float64(F * F) <= 1e-54) tmp = Float64(Float64(pi * l) - Float64(1.0 / Float64(fma((l ^ 2.0), fma(Float64(-(l ^ 2.0)), Float64(Float64((F ^ 2.0) * Float64(Float64(Float64(0.008333333333333333 * (pi ^ 5.0)) - fma((pi ^ 5.0), 0.041666666666666664, Float64(Float64(-0.5 * (pi ^ 2.0)) * Float64((pi ^ 3.0) * 0.3333333333333333)))) / (pi ^ 2.0))) - Float64((F ^ 2.0) * Float64(Float64((pi ^ 6.0) * 0.1111111111111111) / (pi ^ 3.0)))), Float64((F ^ 2.0) * Float64((pi ^ 3.0) * Float64(0.3333333333333333 / Float64(-(pi ^ 2.0)))))), Float64((F ^ 2.0) / pi)) / l))); else tmp = Float64(Float64(pi * l) - Float64(1.0 / Float64(F / Float64(tan(Float64(pi * l)) / F)))); end return tmp end
code[F_, l_] := If[LessEqual[N[(F * F), $MachinePrecision], 1e-320], N[(N[(Pi * l), $MachinePrecision] - N[(N[(N[Tan[N[(l * N[Power[N[Power[Pi, 3.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(F * F), $MachinePrecision], 1e-54], N[(N[(Pi * l), $MachinePrecision] - N[(1.0 / N[(N[(N[Power[l, 2.0], $MachinePrecision] * N[((-N[Power[l, 2.0], $MachinePrecision]) * N[(N[(N[Power[F, 2.0], $MachinePrecision] * N[(N[(N[(0.008333333333333333 * N[Power[Pi, 5.0], $MachinePrecision]), $MachinePrecision] - N[(N[Power[Pi, 5.0], $MachinePrecision] * 0.041666666666666664 + N[(N[(-0.5 * N[Power[Pi, 2.0], $MachinePrecision]), $MachinePrecision] * N[(N[Power[Pi, 3.0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[Pi, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Power[F, 2.0], $MachinePrecision] * N[(N[(N[Power[Pi, 6.0], $MachinePrecision] * 0.1111111111111111), $MachinePrecision] / N[Power[Pi, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[F, 2.0], $MachinePrecision] * N[(N[Power[Pi, 3.0], $MachinePrecision] * N[(0.3333333333333333 / (-N[Power[Pi, 2.0], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[F, 2.0], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision] / l), $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}
\\
\begin{array}{l}
\mathbf{if}\;F \cdot F \leq 10^{-320}:\\
\;\;\;\;\pi \cdot \ell - \frac{\frac{\tan \left(\ell \cdot \sqrt[3]{{\pi}^{3}}\right)}{F}}{F}\\
\mathbf{elif}\;F \cdot F \leq 10^{-54}:\\
\;\;\;\;\pi \cdot \ell - \frac{1}{\frac{\mathsf{fma}\left({\ell}^{2}, \mathsf{fma}\left(-{\ell}^{2}, {F}^{2} \cdot \frac{0.008333333333333333 \cdot {\pi}^{5} - \mathsf{fma}\left({\pi}^{5}, 0.041666666666666664, \left(-0.5 \cdot {\pi}^{2}\right) \cdot \left({\pi}^{3} \cdot 0.3333333333333333\right)\right)}{{\pi}^{2}} - {F}^{2} \cdot \frac{{\pi}^{6} \cdot 0.1111111111111111}{{\pi}^{3}}, {F}^{2} \cdot \left({\pi}^{3} \cdot \frac{0.3333333333333333}{-{\pi}^{2}}\right)\right), \frac{{F}^{2}}{\pi}\right)}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell - \frac{1}{\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}}\\
\end{array}
\end{array}
if (*.f64 F F) < 9.99989e-321Initial program 30.6%
associate-*l/31.2%
*-un-lft-identity31.2%
associate-/r*59.8%
Applied egg-rr59.8%
add-cbrt-cube60.3%
pow360.3%
Applied egg-rr60.3%
if 9.99989e-321 < (*.f64 F F) < 1e-54Initial program 67.2%
associate-*l/68.8%
*-un-lft-identity68.8%
associate-/r*68.9%
clear-num68.9%
Applied egg-rr68.9%
Taylor expanded in l around 0 91.3%
Simplified91.3%
if 1e-54 < (*.f64 F F) Initial program 99.2%
associate-*l/99.2%
*-un-lft-identity99.2%
associate-/r*99.2%
clear-num99.2%
Applied egg-rr99.2%
Final simplification88.2%
(FPCore (F l)
:precision binary64
(if (<= (* F F) 1e-320)
(- (* PI l) (/ (/ (tan (* l (cbrt (pow PI 3.0)))) F) F))
(if (<= (* F F) 1e-54)
(+
(* PI l)
(/
-1.0
(/
(-
(/ (pow F 2.0) PI)
(*
(pow F 2.0)
(*
(pow l 2.0)
(* (pow PI 3.0) (/ 0.3333333333333333 (pow PI 2.0))))))
l)))
(- (* PI l) (/ 1.0 (/ F (/ (tan (* PI l)) F)))))))
double code(double F, double l) {
double tmp;
if ((F * F) <= 1e-320) {
tmp = (((double) M_PI) * l) - ((tan((l * cbrt(pow(((double) M_PI), 3.0)))) / F) / F);
} else if ((F * F) <= 1e-54) {
tmp = (((double) M_PI) * l) + (-1.0 / (((pow(F, 2.0) / ((double) M_PI)) - (pow(F, 2.0) * (pow(l, 2.0) * (pow(((double) M_PI), 3.0) * (0.3333333333333333 / pow(((double) M_PI), 2.0)))))) / l));
} else {
tmp = (((double) M_PI) * l) - (1.0 / (F / (tan((((double) M_PI) * l)) / F)));
}
return tmp;
}
public static double code(double F, double l) {
double tmp;
if ((F * F) <= 1e-320) {
tmp = (Math.PI * l) - ((Math.tan((l * Math.cbrt(Math.pow(Math.PI, 3.0)))) / F) / F);
} else if ((F * F) <= 1e-54) {
tmp = (Math.PI * l) + (-1.0 / (((Math.pow(F, 2.0) / Math.PI) - (Math.pow(F, 2.0) * (Math.pow(l, 2.0) * (Math.pow(Math.PI, 3.0) * (0.3333333333333333 / Math.pow(Math.PI, 2.0)))))) / l));
} else {
tmp = (Math.PI * l) - (1.0 / (F / (Math.tan((Math.PI * l)) / F)));
}
return tmp;
}
function code(F, l) tmp = 0.0 if (Float64(F * F) <= 1e-320) tmp = Float64(Float64(pi * l) - Float64(Float64(tan(Float64(l * cbrt((pi ^ 3.0)))) / F) / F)); elseif (Float64(F * F) <= 1e-54) tmp = Float64(Float64(pi * l) + Float64(-1.0 / Float64(Float64(Float64((F ^ 2.0) / pi) - Float64((F ^ 2.0) * Float64((l ^ 2.0) * Float64((pi ^ 3.0) * Float64(0.3333333333333333 / (pi ^ 2.0)))))) / l))); else tmp = Float64(Float64(pi * l) - Float64(1.0 / Float64(F / Float64(tan(Float64(pi * l)) / F)))); end return tmp end
code[F_, l_] := If[LessEqual[N[(F * F), $MachinePrecision], 1e-320], N[(N[(Pi * l), $MachinePrecision] - N[(N[(N[Tan[N[(l * N[Power[N[Power[Pi, 3.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(F * F), $MachinePrecision], 1e-54], N[(N[(Pi * l), $MachinePrecision] + N[(-1.0 / N[(N[(N[(N[Power[F, 2.0], $MachinePrecision] / Pi), $MachinePrecision] - N[(N[Power[F, 2.0], $MachinePrecision] * N[(N[Power[l, 2.0], $MachinePrecision] * N[(N[Power[Pi, 3.0], $MachinePrecision] * N[(0.3333333333333333 / N[Power[Pi, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $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}
\\
\begin{array}{l}
\mathbf{if}\;F \cdot F \leq 10^{-320}:\\
\;\;\;\;\pi \cdot \ell - \frac{\frac{\tan \left(\ell \cdot \sqrt[3]{{\pi}^{3}}\right)}{F}}{F}\\
\mathbf{elif}\;F \cdot F \leq 10^{-54}:\\
\;\;\;\;\pi \cdot \ell + \frac{-1}{\frac{\frac{{F}^{2}}{\pi} - {F}^{2} \cdot \left({\ell}^{2} \cdot \left({\pi}^{3} \cdot \frac{0.3333333333333333}{{\pi}^{2}}\right)\right)}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell - \frac{1}{\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}}\\
\end{array}
\end{array}
if (*.f64 F F) < 9.99989e-321Initial program 30.6%
associate-*l/31.2%
*-un-lft-identity31.2%
associate-/r*59.8%
Applied egg-rr59.8%
add-cbrt-cube60.3%
pow360.3%
Applied egg-rr60.3%
if 9.99989e-321 < (*.f64 F F) < 1e-54Initial program 67.2%
associate-*l/68.8%
*-un-lft-identity68.8%
associate-/r*68.9%
clear-num68.9%
Applied egg-rr68.9%
Taylor expanded in l around 0 86.2%
Simplified86.2%
if 1e-54 < (*.f64 F F) Initial program 99.2%
associate-*l/99.2%
*-un-lft-identity99.2%
associate-/r*99.2%
clear-num99.2%
Applied egg-rr99.2%
Final simplification87.2%
(FPCore (F l) :precision binary64 (- (* PI l) (/ 1.0 (/ F (/ (tan (* l (cbrt (pow PI 3.0)))) F)))))
double code(double F, double l) {
return (((double) M_PI) * l) - (1.0 / (F / (tan((l * cbrt(pow(((double) M_PI), 3.0)))) / F)));
}
public static double code(double F, double l) {
return (Math.PI * l) - (1.0 / (F / (Math.tan((l * Math.cbrt(Math.pow(Math.PI, 3.0)))) / F)));
}
function code(F, l) return Float64(Float64(pi * l) - Float64(1.0 / Float64(F / Float64(tan(Float64(l * cbrt((pi ^ 3.0)))) / F)))) end
code[F_, l_] := N[(N[(Pi * l), $MachinePrecision] - N[(1.0 / N[(F / N[(N[Tan[N[(l * N[Power[N[Power[Pi, 3.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot \ell - \frac{1}{\frac{F}{\frac{\tan \left(\ell \cdot \sqrt[3]{{\pi}^{3}}\right)}{F}}}
\end{array}
Initial program 76.0%
associate-*l/76.5%
*-un-lft-identity76.5%
associate-/r*83.3%
clear-num83.3%
Applied egg-rr83.3%
add-cbrt-cube83.4%
pow383.4%
Applied egg-rr83.4%
Final simplification83.4%
(FPCore (F l) :precision binary64 (- (* PI l) (/ (/ (tan (* l (cbrt (pow PI 3.0)))) F) F)))
double code(double F, double l) {
return (((double) M_PI) * l) - ((tan((l * cbrt(pow(((double) M_PI), 3.0)))) / F) / F);
}
public static double code(double F, double l) {
return (Math.PI * l) - ((Math.tan((l * Math.cbrt(Math.pow(Math.PI, 3.0)))) / F) / F);
}
function code(F, l) return Float64(Float64(pi * l) - Float64(Float64(tan(Float64(l * cbrt((pi ^ 3.0)))) / F) / F)) end
code[F_, l_] := N[(N[(Pi * l), $MachinePrecision] - N[(N[(N[Tan[N[(l * N[Power[N[Power[Pi, 3.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot \ell - \frac{\frac{\tan \left(\ell \cdot \sqrt[3]{{\pi}^{3}}\right)}{F}}{F}
\end{array}
Initial program 76.0%
associate-*l/76.5%
*-un-lft-identity76.5%
associate-/r*83.3%
Applied egg-rr83.3%
add-cbrt-cube83.4%
pow383.4%
Applied egg-rr83.4%
Final simplification83.4%
(FPCore (F l) :precision binary64 (if (<= (* PI l) 2e-47) (- (* PI l) (* (/ 1.0 F) (* PI (/ l F)))) (- (* PI l) (/ (tan (* PI l)) (* F F)))))
double code(double F, double l) {
double tmp;
if ((((double) M_PI) * l) <= 2e-47) {
tmp = (((double) M_PI) * l) - ((1.0 / F) * (((double) M_PI) * (l / F)));
} 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) <= 2e-47) {
tmp = (Math.PI * l) - ((1.0 / F) * (Math.PI * (l / F)));
} else {
tmp = (Math.PI * l) - (Math.tan((Math.PI * l)) / (F * F));
}
return tmp;
}
def code(F, l): tmp = 0 if (math.pi * l) <= 2e-47: tmp = (math.pi * l) - ((1.0 / F) * (math.pi * (l / F))) 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) <= 2e-47) tmp = Float64(Float64(pi * l) - Float64(Float64(1.0 / F) * Float64(pi * Float64(l / F)))); else tmp = Float64(Float64(pi * l) - Float64(tan(Float64(pi * l)) / Float64(F * F))); end return tmp end
function tmp_2 = code(F, l) tmp = 0.0; if ((pi * l) <= 2e-47) tmp = (pi * l) - ((1.0 / F) * (pi * (l / F))); else tmp = (pi * l) - (tan((pi * l)) / (F * F)); end tmp_2 = tmp; end
code[F_, l_] := If[LessEqual[N[(Pi * l), $MachinePrecision], 2e-47], N[(N[(Pi * l), $MachinePrecision] - N[(N[(1.0 / F), $MachinePrecision] * N[(Pi * 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}
\\
\begin{array}{l}
\mathbf{if}\;\pi \cdot \ell \leq 2 \cdot 10^{-47}:\\
\;\;\;\;\pi \cdot \ell - \frac{1}{F} \cdot \left(\pi \cdot \frac{\ell}{F}\right)\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell - \frac{\tan \left(\pi \cdot \ell\right)}{F \cdot F}\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 1.9999999999999999e-47Initial program 79.6%
*-commutative79.6%
sqr-neg79.6%
associate-*r/79.8%
sqr-neg79.8%
*-rgt-identity79.8%
Simplified79.8%
Taylor expanded in l around 0 74.6%
*-commutative74.6%
*-un-lft-identity74.6%
times-frac84.1%
associate-/l*84.1%
Applied egg-rr84.1%
if 1.9999999999999999e-47 < (*.f64 (PI.f64) l) Initial program 66.4%
*-commutative66.4%
sqr-neg66.4%
associate-*r/67.7%
sqr-neg67.7%
*-rgt-identity67.7%
Simplified67.7%
(FPCore (F l) :precision binary64 (+ (* PI l) (* (/ (tan (* PI l)) F) (/ -1.0 F))))
double code(double F, double l) {
return (((double) M_PI) * l) + ((tan((((double) M_PI) * l)) / F) * (-1.0 / F));
}
public static double code(double F, double l) {
return (Math.PI * l) + ((Math.tan((Math.PI * l)) / F) * (-1.0 / F));
}
def code(F, l): return (math.pi * l) + ((math.tan((math.pi * l)) / F) * (-1.0 / F))
function code(F, l) return Float64(Float64(pi * l) + Float64(Float64(tan(Float64(pi * l)) / F) * Float64(-1.0 / F))) end
function tmp = code(F, l) tmp = (pi * l) + ((tan((pi * l)) / F) * (-1.0 / F)); end
code[F_, l_] := N[(N[(Pi * l), $MachinePrecision] + N[(N[(N[Tan[N[(Pi * l), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision] * N[(-1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot \ell + \frac{\tan \left(\pi \cdot \ell\right)}{F} \cdot \frac{-1}{F}
\end{array}
Initial program 76.0%
*-commutative76.0%
sqr-neg76.0%
associate-*r/76.5%
sqr-neg76.5%
*-rgt-identity76.5%
Simplified76.5%
associate-/r*83.3%
div-inv83.3%
Applied egg-rr83.3%
Final simplification83.3%
(FPCore (F l) :precision binary64 (- (* PI l) (/ (/ (tan (* PI l)) F) F)))
double code(double F, double l) {
return (((double) M_PI) * l) - ((tan((((double) M_PI) * l)) / F) / F);
}
public static double code(double F, double l) {
return (Math.PI * l) - ((Math.tan((Math.PI * l)) / F) / F);
}
def code(F, l): return (math.pi * l) - ((math.tan((math.pi * l)) / F) / F)
function code(F, l) return Float64(Float64(pi * l) - Float64(Float64(tan(Float64(pi * l)) / F) / F)) end
function tmp = code(F, l) tmp = (pi * l) - ((tan((pi * l)) / F) / F); end
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}
\\
\pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}
\end{array}
Initial program 76.0%
associate-*l/76.5%
*-un-lft-identity76.5%
associate-/r*83.3%
Applied egg-rr83.3%
(FPCore (F l) :precision binary64 (if (<= l 0.5) (- (* PI l) (* (/ 1.0 F) (* PI (/ l F)))) (+ (* PI l) (/ (/ 1.0 F) (/ F (* PI l))))))
double code(double F, double l) {
double tmp;
if (l <= 0.5) {
tmp = (((double) M_PI) * l) - ((1.0 / F) * (((double) M_PI) * (l / F)));
} else {
tmp = (((double) M_PI) * l) + ((1.0 / F) / (F / (((double) M_PI) * l)));
}
return tmp;
}
public static double code(double F, double l) {
double tmp;
if (l <= 0.5) {
tmp = (Math.PI * l) - ((1.0 / F) * (Math.PI * (l / F)));
} else {
tmp = (Math.PI * l) + ((1.0 / F) / (F / (Math.PI * l)));
}
return tmp;
}
def code(F, l): tmp = 0 if l <= 0.5: tmp = (math.pi * l) - ((1.0 / F) * (math.pi * (l / F))) else: tmp = (math.pi * l) + ((1.0 / F) / (F / (math.pi * l))) return tmp
function code(F, l) tmp = 0.0 if (l <= 0.5) tmp = Float64(Float64(pi * l) - Float64(Float64(1.0 / F) * Float64(pi * Float64(l / F)))); else tmp = Float64(Float64(pi * l) + Float64(Float64(1.0 / F) / Float64(F / Float64(pi * l)))); end return tmp end
function tmp_2 = code(F, l) tmp = 0.0; if (l <= 0.5) tmp = (pi * l) - ((1.0 / F) * (pi * (l / F))); else tmp = (pi * l) + ((1.0 / F) / (F / (pi * l))); end tmp_2 = tmp; end
code[F_, l_] := If[LessEqual[l, 0.5], N[(N[(Pi * l), $MachinePrecision] - N[(N[(1.0 / F), $MachinePrecision] * N[(Pi * N[(l / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] + N[(N[(1.0 / F), $MachinePrecision] / N[(F / N[(Pi * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 0.5:\\
\;\;\;\;\pi \cdot \ell - \frac{1}{F} \cdot \left(\pi \cdot \frac{\ell}{F}\right)\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell + \frac{\frac{1}{F}}{\frac{F}{\pi \cdot \ell}}\\
\end{array}
\end{array}
if l < 0.5Initial program 80.1%
*-commutative80.1%
sqr-neg80.1%
associate-*r/80.8%
sqr-neg80.8%
*-rgt-identity80.8%
Simplified80.8%
Taylor expanded in l around 0 75.8%
*-commutative75.8%
*-un-lft-identity75.8%
times-frac84.7%
associate-/l*84.7%
Applied egg-rr84.7%
if 0.5 < l Initial program 62.4%
*-commutative62.4%
sqr-neg62.4%
associate-*r/62.4%
sqr-neg62.4%
*-rgt-identity62.4%
Simplified62.4%
add-sqr-sqrt62.4%
sqrt-unprod61.3%
sqr-neg61.3%
swap-sqr61.3%
sqrt-unprod2.2%
add-sqr-sqrt59.6%
distribute-rgt-neg-out59.6%
distribute-frac-neg259.6%
add-sqr-sqrt43.2%
distribute-rgt-neg-in43.2%
sqrt-div33.3%
sqrt-prod12.1%
add-sqr-sqrt32.1%
sqrt-div32.1%
sqrt-prod12.1%
add-sqr-sqrt33.3%
Applied egg-rr33.3%
Applied egg-rr59.6%
Taylor expanded in l around 0 54.7%
Final simplification77.7%
(FPCore (F l) :precision binary64 (- (* PI l) (* (/ 1.0 F) (* PI (/ l F)))))
double code(double F, double l) {
return (((double) M_PI) * l) - ((1.0 / F) * (((double) M_PI) * (l / F)));
}
public static double code(double F, double l) {
return (Math.PI * l) - ((1.0 / F) * (Math.PI * (l / F)));
}
def code(F, l): return (math.pi * l) - ((1.0 / F) * (math.pi * (l / F)))
function code(F, l) return Float64(Float64(pi * l) - Float64(Float64(1.0 / F) * Float64(pi * Float64(l / F)))) end
function tmp = code(F, l) tmp = (pi * l) - ((1.0 / F) * (pi * (l / F))); end
code[F_, l_] := N[(N[(Pi * l), $MachinePrecision] - N[(N[(1.0 / F), $MachinePrecision] * N[(Pi * N[(l / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot \ell - \frac{1}{F} \cdot \left(\pi \cdot \frac{\ell}{F}\right)
\end{array}
Initial program 76.0%
*-commutative76.0%
sqr-neg76.0%
associate-*r/76.5%
sqr-neg76.5%
*-rgt-identity76.5%
Simplified76.5%
Taylor expanded in l around 0 69.8%
*-commutative69.8%
*-un-lft-identity69.8%
times-frac76.6%
associate-/l*76.6%
Applied egg-rr76.6%
(FPCore (F l) :precision binary64 (- (* PI l) (/ PI (* F (/ F l)))))
double code(double F, double l) {
return (((double) M_PI) * l) - (((double) M_PI) / (F * (F / l)));
}
public static double code(double F, double l) {
return (Math.PI * l) - (Math.PI / (F * (F / l)));
}
def code(F, l): return (math.pi * l) - (math.pi / (F * (F / l)))
function code(F, l) return Float64(Float64(pi * l) - Float64(pi / Float64(F * Float64(F / l)))) end
function tmp = code(F, l) tmp = (pi * l) - (pi / (F * (F / l))); end
code[F_, l_] := N[(N[(Pi * l), $MachinePrecision] - N[(Pi / N[(F * N[(F / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot \ell - \frac{\pi}{F \cdot \frac{F}{\ell}}
\end{array}
Initial program 76.0%
*-commutative76.0%
sqr-neg76.0%
associate-*r/76.5%
sqr-neg76.5%
*-rgt-identity76.5%
Simplified76.5%
Taylor expanded in l around 0 69.8%
*-commutative69.8%
times-frac76.6%
Applied egg-rr76.6%
*-commutative76.6%
clear-num76.6%
frac-times76.6%
*-un-lft-identity76.6%
Applied egg-rr76.6%
Final simplification76.6%
(FPCore (F l) :precision binary64 (- (* PI l) (* (/ l F) (/ PI F))))
double code(double F, double l) {
return (((double) M_PI) * l) - ((l / F) * (((double) M_PI) / F));
}
public static double code(double F, double l) {
return (Math.PI * l) - ((l / F) * (Math.PI / F));
}
def code(F, l): return (math.pi * l) - ((l / F) * (math.pi / F))
function code(F, l) return Float64(Float64(pi * l) - Float64(Float64(l / F) * Float64(pi / F))) end
function tmp = code(F, l) tmp = (pi * l) - ((l / F) * (pi / F)); end
code[F_, l_] := N[(N[(Pi * l), $MachinePrecision] - N[(N[(l / F), $MachinePrecision] * N[(Pi / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot \ell - \frac{\ell}{F} \cdot \frac{\pi}{F}
\end{array}
Initial program 76.0%
*-commutative76.0%
sqr-neg76.0%
associate-*r/76.5%
sqr-neg76.5%
*-rgt-identity76.5%
Simplified76.5%
Taylor expanded in l around 0 69.8%
*-commutative69.8%
times-frac76.6%
Applied egg-rr76.6%
Final simplification76.6%
herbie shell --seed 2024112
(FPCore (F l)
:name "VandenBroeck and Keller, Equation (6)"
:precision binary64
(- (* PI l) (* (/ 1.0 (* F F)) (tan (* PI l)))))