Average Error: 16.8 → 1.0
Time: 44.1s
Precision: binary64
Cost: 7816
\[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right)\]
\[\begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -2.5243988018988346 \cdot 10^{+25} \lor \neg \left(\pi \cdot \ell \leq 2.1864373228930277 \cdot 10^{-14}\right):\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell - \frac{1}{F} \cdot \frac{\tan \left(\pi \cdot \ell\right)}{F}\\ \end{array}\]
\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right)
\begin{array}{l}
\mathbf{if}\;\pi \cdot \ell \leq -2.5243988018988346 \cdot 10^{+25} \lor \neg \left(\pi \cdot \ell \leq 2.1864373228930277 \cdot 10^{-14}\right):\\
\;\;\;\;\pi \cdot \ell\\

\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell - \frac{1}{F} \cdot \frac{\tan \left(\pi \cdot \ell\right)}{F}\\

\end{array}
(FPCore (F l)
 :precision binary64
 (- (* PI l) (* (/ 1.0 (* F F)) (tan (* PI l)))))
(FPCore (F l)
 :precision binary64
 (if (or (<= (* PI l) -2.5243988018988346e+25)
         (not (<= (* PI l) 2.1864373228930277e-14)))
   (* PI l)
   (- (* PI l) (* (/ 1.0 F) (/ (tan (* PI l)) F)))))
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 tmp;
	if (((((double) M_PI) * l) <= -2.5243988018988346e+25) || !((((double) M_PI) * l) <= 2.1864373228930277e-14)) {
		tmp = ((double) M_PI) * l;
	} else {
		tmp = (((double) M_PI) * l) - ((1.0 / F) * (tan(((double) M_PI) * l) / F));
	}
	return tmp;
}

Error

Bits error versus F

Bits error versus l

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Alternatives

Alternative 1
Error1.0
Cost7688
\[\begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -2.5243988018988346 \cdot 10^{+25} \lor \neg \left(\pi \cdot \ell \leq 2.1864373228930277 \cdot 10^{-14}\right):\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}\\ \end{array}\]
Alternative 2
Error1.2
Cost1288
\[\begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -2.5243988018988346 \cdot 10^{+25} \lor \neg \left(\pi \cdot \ell \leq 2.1864373228930277 \cdot 10^{-14}\right):\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell - \frac{\pi}{\frac{F}{\frac{\ell}{F}}}\\ \end{array}\]
Alternative 3
Error1.2
Cost1288
\[\begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -2.5243988018988346 \cdot 10^{+25} \lor \neg \left(\pi \cdot \ell \leq 2.1864373228930277 \cdot 10^{-14}\right):\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell - \frac{\pi \cdot \frac{\ell}{F}}{F}\\ \end{array}\]
Alternative 4
Error5.3
Cost1160
\[\begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -2.5243988018988346 \cdot 10^{+25} \lor \neg \left(\pi \cdot \ell \leq 2.1864373228930277 \cdot 10^{-14}\right):\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \left(\ell - \frac{\ell}{F \cdot F}\right)\\ \end{array}\]
Alternative 5
Error14.3
Cost2956
\[\begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -2.496664737276359 \cdot 10^{-141}:\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{elif}\;\pi \cdot \ell \leq -9.759361066142566 \cdot 10^{-193}:\\ \;\;\;\;\frac{-\pi}{\frac{F}{\frac{\ell}{F}}}\\ \mathbf{elif}\;\pi \cdot \ell \leq -2.3954843589194344 \cdot 10^{-245}:\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{elif}\;\pi \cdot \ell \leq 1.4206080086032652 \cdot 10^{-264}:\\ \;\;\;\;\frac{\pi}{F} \cdot \frac{-\ell}{F}\\ \mathbf{elif}\;\pi \cdot \ell \leq 1.3635376942104869 \cdot 10^{-186} \lor \neg \left(\pi \cdot \ell \leq 4.404088826879879 \cdot 10^{-115}\right):\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{F} \cdot \frac{\pi \cdot \ell}{F}\\ \end{array}\]
Alternative 6
Error14.3
Cost2892
\[\begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -2.496664737276359 \cdot 10^{-141}:\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{elif}\;\pi \cdot \ell \leq -9.759361066142566 \cdot 10^{-193}:\\ \;\;\;\;\frac{-\pi}{\frac{F}{\frac{\ell}{F}}}\\ \mathbf{elif}\;\pi \cdot \ell \leq -2.3954843589194344 \cdot 10^{-245}:\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{elif}\;\pi \cdot \ell \leq 1.4206080086032652 \cdot 10^{-264}:\\ \;\;\;\;\frac{\pi}{F} \cdot \frac{-\ell}{F}\\ \mathbf{elif}\;\pi \cdot \ell \leq 1.3635376942104869 \cdot 10^{-186} \lor \neg \left(\pi \cdot \ell \leq 4.404088826879879 \cdot 10^{-115}\right):\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\pi \cdot \left(-\ell\right)}{F}}{F}\\ \end{array}\]
Alternative 7
Error14.3
Cost2892
\[\begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -2.496664737276359 \cdot 10^{-141}:\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{elif}\;\pi \cdot \ell \leq -9.759361066142566 \cdot 10^{-193}:\\ \;\;\;\;\frac{\pi}{F} \cdot \frac{-\ell}{F}\\ \mathbf{elif}\;\pi \cdot \ell \leq -2.3954843589194344 \cdot 10^{-245}:\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{elif}\;\pi \cdot \ell \leq 1.4206080086032652 \cdot 10^{-264}:\\ \;\;\;\;\frac{\pi}{F} \cdot \frac{-\ell}{F}\\ \mathbf{elif}\;\pi \cdot \ell \leq 1.3635376942104869 \cdot 10^{-186} \lor \neg \left(\pi \cdot \ell \leq 4.404088826879879 \cdot 10^{-115}\right):\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\pi \cdot \left(-\ell\right)}{F}}{F}\\ \end{array}\]
Alternative 8
Error14.3
Cost2138
\[\begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -2.496664737276359 \cdot 10^{-141} \lor \neg \left(\pi \cdot \ell \leq -9.759361066142566 \cdot 10^{-193} \lor \neg \left(\pi \cdot \ell \leq -2.3954843589194344 \cdot 10^{-245}\right) \land \left(\pi \cdot \ell \leq 1.4206080086032652 \cdot 10^{-264} \lor \neg \left(\pi \cdot \ell \leq 1.3635376942104869 \cdot 10^{-186}\right) \land \pi \cdot \ell \leq 4.404088826879879 \cdot 10^{-115}\right)\right):\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\frac{\pi}{F} \cdot \frac{-\ell}{F}\\ \end{array}\]
Alternative 9
Error13.7
Cost192
\[\pi \cdot \ell\]
Alternative 10
Error61.8
Cost64
\[1\]

Error

Time

Derivation

  1. Split input into 2 regimes
  2. if (*.f64 PI.f64 l) < -2.5243988018988346e25 or 2.1864373228930277e-14 < (*.f64 PI.f64 l)

    1. Initial program 23.3

      \[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right)\]
    2. Taylor expanded around 0 32.6

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\pi \cdot \ell}{{F}^{2}}}\]
    3. Simplified32.6

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\pi \cdot \ell}{F \cdot F}}\]
    4. Taylor expanded around inf 1.0

      \[\leadsto \color{blue}{\pi \cdot \ell}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity_binary641.0

      \[\leadsto \color{blue}{1 \cdot \left(\pi \cdot \ell\right)}\]
    7. Using strategy rm
    8. Applied *-un-lft-identity_binary641.0

      \[\leadsto 1 \cdot \color{blue}{\left(1 \cdot \left(\pi \cdot \ell\right)\right)}\]
    9. Simplified1.0

      \[\leadsto \color{blue}{\pi \cdot \ell}\]

    if -2.5243988018988346e25 < (*.f64 PI.f64 l) < 2.1864373228930277e-14

    1. Initial program 10.0

      \[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right)\]
    2. Using strategy rm
    3. Applied *-un-lft-identity_binary6410.0

      \[\leadsto \pi \cdot \ell - \frac{\color{blue}{1 \cdot 1}}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right)\]
    4. Applied times-frac_binary6410.0

      \[\leadsto \pi \cdot \ell - \color{blue}{\left(\frac{1}{F} \cdot \frac{1}{F}\right)} \cdot \tan \left(\pi \cdot \ell\right)\]
    5. Applied associate-*l*_binary641.2

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -2.5243988018988346 \cdot 10^{+25} \lor \neg \left(\pi \cdot \ell \leq 2.1864373228930277 \cdot 10^{-14}\right):\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell - \frac{1}{F} \cdot \frac{\tan \left(\pi \cdot \ell\right)}{F}\\ \end{array}\]

Reproduce

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