?

Average Accuracy: 76.5% → 87.5%
Time: 15.6s
Precision: binary64
Cost: 46217

?

\[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right) \]
\[\begin{array}{l} t_0 := \tan \left(\pi \cdot \ell\right)\\ \mathbf{if}\;\pi \cdot \ell \leq -2 \cdot 10^{+16} \lor \neg \left(\pi \cdot \ell \leq 5 \cdot 10^{+28}\right):\\ \;\;\;\;\pi \cdot \ell - \mathsf{expm1}\left(\frac{1}{F \cdot F} - \frac{0.5}{{F}^{4}}\right) \cdot t_0\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell + \frac{-1}{F \cdot \frac{F}{t_0}}\\ \end{array} \]
(FPCore (F l)
 :precision binary64
 (- (* PI l) (* (/ 1.0 (* F F)) (tan (* PI l)))))
(FPCore (F l)
 :precision binary64
 (let* ((t_0 (tan (* PI l))))
   (if (or (<= (* PI l) -2e+16) (not (<= (* PI l) 5e+28)))
     (- (* PI l) (* (expm1 (- (/ 1.0 (* F F)) (/ 0.5 (pow F 4.0)))) t_0))
     (+ (* PI l) (/ -1.0 (* F (/ F t_0)))))))
double code(double F, double l) {
	return (((double) M_PI) * l) - ((1.0 / (F * F)) * tan((((double) M_PI) * l)));
}
double code(double F, double l) {
	double t_0 = tan((((double) M_PI) * l));
	double tmp;
	if (((((double) M_PI) * l) <= -2e+16) || !((((double) M_PI) * l) <= 5e+28)) {
		tmp = (((double) M_PI) * l) - (expm1(((1.0 / (F * F)) - (0.5 / pow(F, 4.0)))) * t_0);
	} else {
		tmp = (((double) M_PI) * l) + (-1.0 / (F * (F / t_0)));
	}
	return tmp;
}
public static double code(double F, double l) {
	return (Math.PI * l) - ((1.0 / (F * F)) * Math.tan((Math.PI * l)));
}
public static double code(double F, double l) {
	double t_0 = Math.tan((Math.PI * l));
	double tmp;
	if (((Math.PI * l) <= -2e+16) || !((Math.PI * l) <= 5e+28)) {
		tmp = (Math.PI * l) - (Math.expm1(((1.0 / (F * F)) - (0.5 / Math.pow(F, 4.0)))) * t_0);
	} else {
		tmp = (Math.PI * l) + (-1.0 / (F * (F / t_0)));
	}
	return tmp;
}
def code(F, l):
	return (math.pi * l) - ((1.0 / (F * F)) * math.tan((math.pi * l)))
def code(F, l):
	t_0 = math.tan((math.pi * l))
	tmp = 0
	if ((math.pi * l) <= -2e+16) or not ((math.pi * l) <= 5e+28):
		tmp = (math.pi * l) - (math.expm1(((1.0 / (F * F)) - (0.5 / math.pow(F, 4.0)))) * t_0)
	else:
		tmp = (math.pi * l) + (-1.0 / (F * (F / t_0)))
	return tmp
function code(F, l)
	return Float64(Float64(pi * l) - Float64(Float64(1.0 / Float64(F * F)) * tan(Float64(pi * l))))
end
function code(F, l)
	t_0 = tan(Float64(pi * l))
	tmp = 0.0
	if ((Float64(pi * l) <= -2e+16) || !(Float64(pi * l) <= 5e+28))
		tmp = Float64(Float64(pi * l) - Float64(expm1(Float64(Float64(1.0 / Float64(F * F)) - Float64(0.5 / (F ^ 4.0)))) * t_0));
	else
		tmp = Float64(Float64(pi * l) + Float64(-1.0 / Float64(F * Float64(F / t_0))));
	end
	return tmp
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]
code[F_, l_] := Block[{t$95$0 = N[Tan[N[(Pi * l), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[N[(Pi * l), $MachinePrecision], -2e+16], N[Not[LessEqual[N[(Pi * l), $MachinePrecision], 5e+28]], $MachinePrecision]], N[(N[(Pi * l), $MachinePrecision] - N[(N[(Exp[N[(N[(1.0 / N[(F * F), $MachinePrecision]), $MachinePrecision] - N[(0.5 / N[Power[F, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] + N[(-1.0 / N[(F * N[(F / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right)
\begin{array}{l}
t_0 := \tan \left(\pi \cdot \ell\right)\\
\mathbf{if}\;\pi \cdot \ell \leq -2 \cdot 10^{+16} \lor \neg \left(\pi \cdot \ell \leq 5 \cdot 10^{+28}\right):\\
\;\;\;\;\pi \cdot \ell - \mathsf{expm1}\left(\frac{1}{F \cdot F} - \frac{0.5}{{F}^{4}}\right) \cdot t_0\\

\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell + \frac{-1}{F \cdot \frac{F}{t_0}}\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Split input into 2 regimes
  2. if (*.f64 (PI.f64) l) < -2e16 or 4.99999999999999957e28 < (*.f64 (PI.f64) l)

    1. Initial program 61.9%

      \[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right) \]
    2. Applied egg-rr61.9%

      \[\leadsto \pi \cdot \ell - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({F}^{-2}\right)\right)} \cdot \tan \left(\pi \cdot \ell\right) \]
      Step-by-step derivation

      [Start]61.9

      \[ \pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right) \]

      expm1-log1p-u [=>]61.9

      \[ \pi \cdot \ell - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{F \cdot F}\right)\right)} \cdot \tan \left(\pi \cdot \ell\right) \]

      pow2 [=>]61.9

      \[ \pi \cdot \ell - \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{\color{blue}{{F}^{2}}}\right)\right) \cdot \tan \left(\pi \cdot \ell\right) \]

      pow-flip [=>]61.9

      \[ \pi \cdot \ell - \mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{{F}^{\left(-2\right)}}\right)\right) \cdot \tan \left(\pi \cdot \ell\right) \]

      metadata-eval [=>]61.9

      \[ \pi \cdot \ell - \mathsf{expm1}\left(\mathsf{log1p}\left({F}^{\color{blue}{-2}}\right)\right) \cdot \tan \left(\pi \cdot \ell\right) \]
    3. Taylor expanded in F around inf 77.7%

      \[\leadsto \pi \cdot \ell - \mathsf{expm1}\left(\color{blue}{\frac{1}{{F}^{2}} - 0.5 \cdot \frac{1}{{F}^{4}}}\right) \cdot \tan \left(\pi \cdot \ell\right) \]
    4. Simplified77.7%

      \[\leadsto \pi \cdot \ell - \mathsf{expm1}\left(\color{blue}{\frac{1}{F \cdot F} - \frac{0.5}{{F}^{4}}}\right) \cdot \tan \left(\pi \cdot \ell\right) \]
      Step-by-step derivation

      [Start]77.7

      \[ \pi \cdot \ell - \mathsf{expm1}\left(\frac{1}{{F}^{2}} - 0.5 \cdot \frac{1}{{F}^{4}}\right) \cdot \tan \left(\pi \cdot \ell\right) \]

      unpow2 [=>]77.7

      \[ \pi \cdot \ell - \mathsf{expm1}\left(\frac{1}{\color{blue}{F \cdot F}} - 0.5 \cdot \frac{1}{{F}^{4}}\right) \cdot \tan \left(\pi \cdot \ell\right) \]

      associate-*r/ [=>]77.7

      \[ \pi \cdot \ell - \mathsf{expm1}\left(\frac{1}{F \cdot F} - \color{blue}{\frac{0.5 \cdot 1}{{F}^{4}}}\right) \cdot \tan \left(\pi \cdot \ell\right) \]

      metadata-eval [=>]77.7

      \[ \pi \cdot \ell - \mathsf{expm1}\left(\frac{1}{F \cdot F} - \frac{\color{blue}{0.5}}{{F}^{4}}\right) \cdot \tan \left(\pi \cdot \ell\right) \]

    if -2e16 < (*.f64 (PI.f64) l) < 4.99999999999999957e28

    1. Initial program 85.0%

      \[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right) \]
    2. Simplified85.6%

      \[\leadsto \color{blue}{\pi \cdot \ell - \frac{\tan \left(\pi \cdot \ell\right)}{F \cdot F}} \]
      Step-by-step derivation

      [Start]85.0

      \[ \pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right) \]

      associate-*l/ [=>]85.6

      \[ \pi \cdot \ell - \color{blue}{\frac{1 \cdot \tan \left(\pi \cdot \ell\right)}{F \cdot F}} \]

      *-lft-identity [=>]85.6

      \[ \pi \cdot \ell - \frac{\color{blue}{\tan \left(\pi \cdot \ell\right)}}{F \cdot F} \]
    3. Applied egg-rr98.6%

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\tan \left(\pi \cdot \ell\right)}{F} \cdot \frac{1}{F}} \]
      Step-by-step derivation

      [Start]85.6

      \[ \pi \cdot \ell - \frac{\tan \left(\pi \cdot \ell\right)}{F \cdot F} \]

      associate-/r* [=>]98.7

      \[ \pi \cdot \ell - \color{blue}{\frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}} \]

      div-inv [=>]98.6

      \[ \pi \cdot \ell - \color{blue}{\frac{\tan \left(\pi \cdot \ell\right)}{F} \cdot \frac{1}{F}} \]
    4. Applied egg-rr98.7%

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{1}{\frac{F}{\tan \left(\pi \cdot \ell\right)} \cdot F}} \]
      Step-by-step derivation

      [Start]98.6

      \[ \pi \cdot \ell - \frac{\tan \left(\pi \cdot \ell\right)}{F} \cdot \frac{1}{F} \]

      clear-num [=>]98.6

      \[ \pi \cdot \ell - \color{blue}{\frac{1}{\frac{F}{\tan \left(\pi \cdot \ell\right)}}} \cdot \frac{1}{F} \]

      frac-times [=>]98.7

      \[ \pi \cdot \ell - \color{blue}{\frac{1 \cdot 1}{\frac{F}{\tan \left(\pi \cdot \ell\right)} \cdot F}} \]

      metadata-eval [=>]98.7

      \[ \pi \cdot \ell - \frac{\color{blue}{1}}{\frac{F}{\tan \left(\pi \cdot \ell\right)} \cdot F} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification89.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -2 \cdot 10^{+16} \lor \neg \left(\pi \cdot \ell \leq 5 \cdot 10^{+28}\right):\\ \;\;\;\;\pi \cdot \ell - \mathsf{expm1}\left(\frac{1}{F \cdot F} - \frac{0.5}{{F}^{4}}\right) \cdot \tan \left(\pi \cdot \ell\right)\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell + \frac{-1}{F \cdot \frac{F}{\tan \left(\pi \cdot \ell\right)}}\\ \end{array} \]

Alternatives

Alternative 1
Accuracy82.1%
Cost32969
\[\begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -100000 \lor \neg \left(\pi \cdot \ell \leq 5 \cdot 10^{-54}\right):\\ \;\;\;\;\pi \cdot \ell - \frac{\tan \left(\pi \cdot \ell\right)}{F \cdot F}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell - \frac{\frac{\pi}{F}}{\frac{F}{\ell}}\\ \end{array} \]
Alternative 2
Accuracy82.3%
Cost19904
\[\pi \cdot \ell + \frac{-1}{F \cdot \frac{F}{\tan \left(\pi \cdot \ell\right)}} \]
Alternative 3
Accuracy82.3%
Cost19776
\[\pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F} \]
Alternative 4
Accuracy69.0%
Cost13376
\[\pi \cdot \ell - \pi \cdot \frac{\ell}{F \cdot F} \]
Alternative 5
Accuracy74.5%
Cost13376
\[\pi \cdot \ell - \frac{\pi}{F} \cdot \frac{\ell}{F} \]
Alternative 6
Accuracy74.5%
Cost13376
\[\pi \cdot \ell - \frac{\frac{\pi}{F}}{\frac{F}{\ell}} \]

Error

Reproduce?

herbie shell --seed 2023158 
(FPCore (F l)
  :name "VandenBroeck and Keller, Equation (6)"
  :precision binary64
  (- (* PI l) (* (/ 1.0 (* F F)) (tan (* PI l)))))