
(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}
(FPCore (F l)
:precision binary64
(let* ((t_0 (/ (pow F 2.0) (pow PI 2.0)))
(t_1 (* 0.008333333333333333 (pow PI 5.0)))
(t_2
(fma
-0.5
(* (* (pow PI 2.0) (pow PI 3.0)) 0.3333333333333333)
(* (pow PI 5.0) 0.041666666666666664)))
(t_3 (- t_1 t_2))
(t_4 (* (pow PI 3.0) 0.3333333333333333))
(t_5 (* (pow F 2.0) (/ (pow t_4 2.0) (pow PI 3.0)))))
(if (or (<= (* F F) 1e-322) (not (<= (* F F) 1e-88)))
(- (* PI l) (/ (/ (tan (* PI l)) F) F))
(-
(* PI l)
(/
1.0
(/
(fma
(pow l 2.0)
(fma
(pow l 2.0)
(+
(*
(pow l 2.0)
(+
(* t_4 (/ (- (* t_3 t_0) t_5) PI))
(+
(* (* t_3 t_4) (/ (pow F 2.0) (pow PI 3.0)))
(*
t_0
(-
(fma
-0.5
(* (pow PI 2.0) t_3)
(fma
0.041666666666666664
(* (pow PI 3.0) (* 0.3333333333333333 (pow PI 4.0)))
(* (pow PI 7.0) -0.001388888888888889)))
(* -0.0001984126984126984 (pow PI 7.0)))))))
(+ t_5 (* t_0 (- t_2 t_1))))
(*
(pow F 2.0)
(* (pow PI 3.0) (/ 0.3333333333333333 (- (pow PI 2.0))))))
(/ (pow F 2.0) PI))
l))))))
double code(double F, double l) {
double t_0 = pow(F, 2.0) / pow(((double) M_PI), 2.0);
double t_1 = 0.008333333333333333 * pow(((double) M_PI), 5.0);
double t_2 = fma(-0.5, ((pow(((double) M_PI), 2.0) * pow(((double) M_PI), 3.0)) * 0.3333333333333333), (pow(((double) M_PI), 5.0) * 0.041666666666666664));
double t_3 = t_1 - t_2;
double t_4 = pow(((double) M_PI), 3.0) * 0.3333333333333333;
double t_5 = pow(F, 2.0) * (pow(t_4, 2.0) / pow(((double) M_PI), 3.0));
double tmp;
if (((F * F) <= 1e-322) || !((F * F) <= 1e-88)) {
tmp = (((double) M_PI) * l) - ((tan((((double) M_PI) * l)) / F) / F);
} else {
tmp = (((double) M_PI) * l) - (1.0 / (fma(pow(l, 2.0), fma(pow(l, 2.0), ((pow(l, 2.0) * ((t_4 * (((t_3 * t_0) - t_5) / ((double) M_PI))) + (((t_3 * t_4) * (pow(F, 2.0) / pow(((double) M_PI), 3.0))) + (t_0 * (fma(-0.5, (pow(((double) M_PI), 2.0) * t_3), fma(0.041666666666666664, (pow(((double) M_PI), 3.0) * (0.3333333333333333 * pow(((double) M_PI), 4.0))), (pow(((double) M_PI), 7.0) * -0.001388888888888889))) - (-0.0001984126984126984 * pow(((double) M_PI), 7.0))))))) + (t_5 + (t_0 * (t_2 - t_1)))), (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));
}
return tmp;
}
function code(F, l) t_0 = Float64((F ^ 2.0) / (pi ^ 2.0)) t_1 = Float64(0.008333333333333333 * (pi ^ 5.0)) t_2 = fma(-0.5, Float64(Float64((pi ^ 2.0) * (pi ^ 3.0)) * 0.3333333333333333), Float64((pi ^ 5.0) * 0.041666666666666664)) t_3 = Float64(t_1 - t_2) t_4 = Float64((pi ^ 3.0) * 0.3333333333333333) t_5 = Float64((F ^ 2.0) * Float64((t_4 ^ 2.0) / (pi ^ 3.0))) tmp = 0.0 if ((Float64(F * F) <= 1e-322) || !(Float64(F * F) <= 1e-88)) tmp = Float64(Float64(pi * l) - Float64(Float64(tan(Float64(pi * l)) / F) / F)); else tmp = Float64(Float64(pi * l) - Float64(1.0 / Float64(fma((l ^ 2.0), fma((l ^ 2.0), Float64(Float64((l ^ 2.0) * Float64(Float64(t_4 * Float64(Float64(Float64(t_3 * t_0) - t_5) / pi)) + Float64(Float64(Float64(t_3 * t_4) * Float64((F ^ 2.0) / (pi ^ 3.0))) + Float64(t_0 * Float64(fma(-0.5, Float64((pi ^ 2.0) * t_3), fma(0.041666666666666664, Float64((pi ^ 3.0) * Float64(0.3333333333333333 * (pi ^ 4.0))), Float64((pi ^ 7.0) * -0.001388888888888889))) - Float64(-0.0001984126984126984 * (pi ^ 7.0))))))) + Float64(t_5 + Float64(t_0 * Float64(t_2 - t_1)))), Float64((F ^ 2.0) * Float64((pi ^ 3.0) * Float64(0.3333333333333333 / Float64(-(pi ^ 2.0)))))), Float64((F ^ 2.0) / pi)) / l))); end return tmp end
code[F_, l_] := Block[{t$95$0 = N[(N[Power[F, 2.0], $MachinePrecision] / N[Power[Pi, 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.008333333333333333 * N[Power[Pi, 5.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(-0.5 * N[(N[(N[Power[Pi, 2.0], $MachinePrecision] * N[Power[Pi, 3.0], $MachinePrecision]), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] + N[(N[Power[Pi, 5.0], $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 - t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(N[Power[Pi, 3.0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]}, Block[{t$95$5 = N[(N[Power[F, 2.0], $MachinePrecision] * N[(N[Power[t$95$4, 2.0], $MachinePrecision] / N[Power[Pi, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[N[(F * F), $MachinePrecision], 1e-322], N[Not[LessEqual[N[(F * F), $MachinePrecision], 1e-88]], $MachinePrecision]], N[(N[(Pi * l), $MachinePrecision] - N[(N[(N[Tan[N[(Pi * l), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision], 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[(t$95$4 * N[(N[(N[(t$95$3 * t$95$0), $MachinePrecision] - t$95$5), $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(t$95$3 * t$95$4), $MachinePrecision] * N[(N[Power[F, 2.0], $MachinePrecision] / N[Power[Pi, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * N[(N[(-0.5 * N[(N[Power[Pi, 2.0], $MachinePrecision] * t$95$3), $MachinePrecision] + N[(0.041666666666666664 * N[(N[Power[Pi, 3.0], $MachinePrecision] * N[(0.3333333333333333 * N[Power[Pi, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[Pi, 7.0], $MachinePrecision] * -0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(-0.0001984126984126984 * N[Power[Pi, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$5 + N[(t$95$0 * N[(t$95$2 - t$95$1), $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]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{{F}^{2}}{{\pi}^{2}}\\
t_1 := 0.008333333333333333 \cdot {\pi}^{5}\\
t_2 := \mathsf{fma}\left(-0.5, \left({\pi}^{2} \cdot {\pi}^{3}\right) \cdot 0.3333333333333333, {\pi}^{5} \cdot 0.041666666666666664\right)\\
t_3 := t\_1 - t\_2\\
t_4 := {\pi}^{3} \cdot 0.3333333333333333\\
t_5 := {F}^{2} \cdot \frac{{t\_4}^{2}}{{\pi}^{3}}\\
\mathbf{if}\;F \cdot F \leq 10^{-322} \lor \neg \left(F \cdot F \leq 10^{-88}\right):\\
\;\;\;\;\pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell - \frac{1}{\frac{\mathsf{fma}\left({\ell}^{2}, \mathsf{fma}\left({\ell}^{2}, {\ell}^{2} \cdot \left(t\_4 \cdot \frac{t\_3 \cdot t\_0 - t\_5}{\pi} + \left(\left(t\_3 \cdot t\_4\right) \cdot \frac{{F}^{2}}{{\pi}^{3}} + t\_0 \cdot \left(\mathsf{fma}\left(-0.5, {\pi}^{2} \cdot t\_3, \mathsf{fma}\left(0.041666666666666664, {\pi}^{3} \cdot \left(0.3333333333333333 \cdot {\pi}^{4}\right), {\pi}^{7} \cdot -0.001388888888888889\right)\right) - -0.0001984126984126984 \cdot {\pi}^{7}\right)\right)\right) + \left(t\_5 + t\_0 \cdot \left(t\_2 - t\_1\right)\right), {F}^{2} \cdot \left({\pi}^{3} \cdot \frac{0.3333333333333333}{-{\pi}^{2}}\right)\right), \frac{{F}^{2}}{\pi}\right)}{\ell}}\\
\end{array}
\end{array}
if (*.f64 F F) < 9.88131e-323 or 9.99999999999999934e-89 < (*.f64 F F) Initial program 81.1%
associate-*l/81.3%
*-un-lft-identity81.3%
associate-/r*89.3%
Applied egg-rr89.3%
if 9.88131e-323 < (*.f64 F F) < 9.99999999999999934e-89Initial program 68.6%
associate-/r/68.7%
pow268.7%
Applied egg-rr68.7%
Taylor expanded in l around 0 95.6%
Simplified95.6%
Final simplification90.5%
(FPCore (F l)
:precision binary64
(if (or (<= (* F F) 1e-322) (not (<= (* F F) 1e-88)))
(- (* PI l) (/ (/ (tan (* PI l)) F) F))
(-
(* PI l)
(/
1.0
(/
(fma
(pow l 2.0)
(fma
(-
(*
(-
(* 0.008333333333333333 (pow PI 5.0))
(fma
-0.5
(* (* (pow PI 2.0) (pow PI 3.0)) 0.3333333333333333)
(* (pow PI 5.0) 0.041666666666666664)))
(/ (pow F 2.0) (pow PI 2.0)))
(*
(pow F 2.0)
(/ (pow (* (pow PI 3.0) 0.3333333333333333) 2.0) (pow PI 3.0))))
(- (pow l 2.0))
(*
(pow F 2.0)
(* (pow PI 3.0) (/ 0.3333333333333333 (- (pow PI 2.0))))))
(/ (pow F 2.0) PI))
l)))))
double code(double F, double l) {
double tmp;
if (((F * F) <= 1e-322) || !((F * F) <= 1e-88)) {
tmp = (((double) M_PI) * l) - ((tan((((double) M_PI) * l)) / F) / F);
} else {
tmp = (((double) M_PI) * l) - (1.0 / (fma(pow(l, 2.0), fma(((((0.008333333333333333 * pow(((double) M_PI), 5.0)) - fma(-0.5, ((pow(((double) M_PI), 2.0) * pow(((double) M_PI), 3.0)) * 0.3333333333333333), (pow(((double) M_PI), 5.0) * 0.041666666666666664))) * (pow(F, 2.0) / pow(((double) M_PI), 2.0))) - (pow(F, 2.0) * (pow((pow(((double) M_PI), 3.0) * 0.3333333333333333), 2.0) / pow(((double) M_PI), 3.0)))), -pow(l, 2.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));
}
return tmp;
}
function code(F, l) tmp = 0.0 if ((Float64(F * F) <= 1e-322) || !(Float64(F * F) <= 1e-88)) tmp = Float64(Float64(pi * l) - Float64(Float64(tan(Float64(pi * l)) / F) / F)); else tmp = Float64(Float64(pi * l) - Float64(1.0 / Float64(fma((l ^ 2.0), fma(Float64(Float64(Float64(Float64(0.008333333333333333 * (pi ^ 5.0)) - fma(-0.5, Float64(Float64((pi ^ 2.0) * (pi ^ 3.0)) * 0.3333333333333333), Float64((pi ^ 5.0) * 0.041666666666666664))) * Float64((F ^ 2.0) / (pi ^ 2.0))) - Float64((F ^ 2.0) * Float64((Float64((pi ^ 3.0) * 0.3333333333333333) ^ 2.0) / (pi ^ 3.0)))), Float64(-(l ^ 2.0)), Float64((F ^ 2.0) * Float64((pi ^ 3.0) * Float64(0.3333333333333333 / Float64(-(pi ^ 2.0)))))), Float64((F ^ 2.0) / pi)) / l))); end return tmp end
code[F_, l_] := If[Or[LessEqual[N[(F * F), $MachinePrecision], 1e-322], N[Not[LessEqual[N[(F * F), $MachinePrecision], 1e-88]], $MachinePrecision]], N[(N[(Pi * l), $MachinePrecision] - N[(N[(N[Tan[N[(Pi * l), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] - N[(1.0 / N[(N[(N[Power[l, 2.0], $MachinePrecision] * N[(N[(N[(N[(N[(0.008333333333333333 * N[Power[Pi, 5.0], $MachinePrecision]), $MachinePrecision] - N[(-0.5 * N[(N[(N[Power[Pi, 2.0], $MachinePrecision] * N[Power[Pi, 3.0], $MachinePrecision]), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] + N[(N[Power[Pi, 5.0], $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[F, 2.0], $MachinePrecision] / N[Power[Pi, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Power[F, 2.0], $MachinePrecision] * N[(N[Power[N[(N[Power[Pi, 3.0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision], 2.0], $MachinePrecision] / N[Power[Pi, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * (-N[Power[l, 2.0], $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]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \cdot F \leq 10^{-322} \lor \neg \left(F \cdot F \leq 10^{-88}\right):\\
\;\;\;\;\pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell - \frac{1}{\frac{\mathsf{fma}\left({\ell}^{2}, \mathsf{fma}\left(\left(0.008333333333333333 \cdot {\pi}^{5} - \mathsf{fma}\left(-0.5, \left({\pi}^{2} \cdot {\pi}^{3}\right) \cdot 0.3333333333333333, {\pi}^{5} \cdot 0.041666666666666664\right)\right) \cdot \frac{{F}^{2}}{{\pi}^{2}} - {F}^{2} \cdot \frac{{\left({\pi}^{3} \cdot 0.3333333333333333\right)}^{2}}{{\pi}^{3}}, -{\ell}^{2}, {F}^{2} \cdot \left({\pi}^{3} \cdot \frac{0.3333333333333333}{-{\pi}^{2}}\right)\right), \frac{{F}^{2}}{\pi}\right)}{\ell}}\\
\end{array}
\end{array}
if (*.f64 F F) < 9.88131e-323 or 9.99999999999999934e-89 < (*.f64 F F) Initial program 81.1%
associate-*l/81.3%
*-un-lft-identity81.3%
associate-/r*89.3%
Applied egg-rr89.3%
if 9.88131e-323 < (*.f64 F F) < 9.99999999999999934e-89Initial program 68.6%
associate-/r/68.7%
pow268.7%
Applied egg-rr68.7%
Taylor expanded in l around 0 93.8%
Simplified93.8%
Final simplification90.1%
(FPCore (F l) :precision binary64 (if (<= (* PI l) 2e-69) (- (* PI l) (/ (/ (* PI l) F) F)) (- (* PI l) (/ (tan (* PI l)) (* F F)))))
double code(double F, double l) {
double tmp;
if ((((double) M_PI) * l) <= 2e-69) {
tmp = (((double) M_PI) * l) - (((((double) M_PI) * l) / F) / 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-69) {
tmp = (Math.PI * l) - (((Math.PI * l) / F) / 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-69: tmp = (math.pi * l) - (((math.pi * l) / F) / 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-69) tmp = Float64(Float64(pi * l) - Float64(Float64(Float64(pi * l) / F) / 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-69) tmp = (pi * l) - (((pi * l) / F) / 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-69], N[(N[(Pi * l), $MachinePrecision] - N[(N[(N[(Pi * l), $MachinePrecision] / F), $MachinePrecision] / F), $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^{-69}:\\
\;\;\;\;\pi \cdot \ell - \frac{\frac{\pi \cdot \ell}{F}}{F}\\
\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-69Initial program 80.3%
associate-*l/80.4%
*-un-lft-identity80.4%
associate-/r*89.3%
Applied egg-rr89.3%
Taylor expanded in l around 0 84.8%
if 1.9999999999999999e-69 < (*.f64 (PI.f64) l) Initial program 74.5%
*-commutative74.5%
sqr-neg74.5%
associate-*r/74.5%
sqr-neg74.5%
*-rgt-identity74.5%
Simplified74.5%
Final simplification82.0%
(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 78.7%
associate-*l/78.8%
*-un-lft-identity78.8%
associate-/r*85.3%
Applied egg-rr85.3%
Final simplification85.3%
(FPCore (F l) :precision binary64 (- (* PI l) (* (/ PI F) (/ l F))))
double code(double F, double l) {
return (((double) M_PI) * l) - ((((double) M_PI) / F) * (l / F));
}
public static double code(double F, double l) {
return (Math.PI * l) - ((Math.PI / F) * (l / F));
}
def code(F, l): return (math.pi * l) - ((math.pi / F) * (l / F))
function code(F, l) return Float64(Float64(pi * l) - Float64(Float64(pi / F) * Float64(l / F))) end
function tmp = code(F, l) tmp = (pi * l) - ((pi / F) * (l / F)); end
code[F_, l_] := N[(N[(Pi * l), $MachinePrecision] - N[(N[(Pi / F), $MachinePrecision] * N[(l / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot \ell - \frac{\pi}{F} \cdot \frac{\ell}{F}
\end{array}
Initial program 78.7%
*-commutative78.7%
sqr-neg78.7%
associate-*r/78.8%
sqr-neg78.8%
*-rgt-identity78.8%
Simplified78.8%
Taylor expanded in l around 0 71.9%
*-commutative71.9%
times-frac78.2%
Applied egg-rr78.2%
Final simplification78.2%
(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 78.7%
*-commutative78.7%
sqr-neg78.7%
associate-*r/78.8%
sqr-neg78.8%
*-rgt-identity78.8%
Simplified78.8%
Taylor expanded in l around 0 71.9%
*-commutative71.9%
times-frac78.2%
Applied egg-rr78.2%
*-commutative78.2%
clear-num78.2%
frac-times78.3%
*-un-lft-identity78.3%
Applied egg-rr78.3%
Final simplification78.3%
(FPCore (F l) :precision binary64 (- (* PI l) (/ (/ (* PI l) F) F)))
double code(double F, double l) {
return (((double) M_PI) * l) - (((((double) M_PI) * l) / F) / F);
}
public static double code(double F, double l) {
return (Math.PI * l) - (((Math.PI * l) / F) / F);
}
def code(F, l): return (math.pi * l) - (((math.pi * l) / F) / F)
function code(F, l) return Float64(Float64(pi * l) - Float64(Float64(Float64(pi * l) / F) / F)) end
function tmp = code(F, l) tmp = (pi * l) - (((pi * l) / F) / F); end
code[F_, l_] := N[(N[(Pi * l), $MachinePrecision] - N[(N[(N[(Pi * l), $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot \ell - \frac{\frac{\pi \cdot \ell}{F}}{F}
\end{array}
Initial program 78.7%
associate-*l/78.8%
*-un-lft-identity78.8%
associate-/r*85.3%
Applied egg-rr85.3%
Taylor expanded in l around 0 78.3%
Final simplification78.3%
herbie shell --seed 2024067
(FPCore (F l)
:name "VandenBroeck and Keller, Equation (6)"
:precision binary64
(- (* PI l) (* (/ 1.0 (* F F)) (tan (* PI l)))))