Average Error: 31.9 → 0.0
Time: 31.4s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.0654189940460499:\\ \;\;\;\;\frac{x}{x - \tan x} - \log \left(e^{\frac{\sin x}{x - \tan x}}\right)\\ \mathbf{elif}\;x \le 0.06331538098159631:\\ \;\;\;\;\left(\frac{-1}{2} + x \cdot \left(x \cdot \frac{9}{40}\right)\right) + \frac{-27}{2800} \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x - \tan x} - \log \left(e^{\frac{\sin x}{x - \tan x}}\right)\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.0654189940460499:\\
\;\;\;\;\frac{x}{x - \tan x} - \log \left(e^{\frac{\sin x}{x - \tan x}}\right)\\

\mathbf{elif}\;x \le 0.06331538098159631:\\
\;\;\;\;\left(\frac{-1}{2} + x \cdot \left(x \cdot \frac{9}{40}\right)\right) + \frac{-27}{2800} \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{x - \tan x} - \log \left(e^{\frac{\sin x}{x - \tan x}}\right)\\

\end{array}
double f(double x) {
        double r863456 = x;
        double r863457 = sin(r863456);
        double r863458 = r863456 - r863457;
        double r863459 = tan(r863456);
        double r863460 = r863456 - r863459;
        double r863461 = r863458 / r863460;
        return r863461;
}

double f(double x) {
        double r863462 = x;
        double r863463 = -0.0654189940460499;
        bool r863464 = r863462 <= r863463;
        double r863465 = tan(r863462);
        double r863466 = r863462 - r863465;
        double r863467 = r863462 / r863466;
        double r863468 = sin(r863462);
        double r863469 = r863468 / r863466;
        double r863470 = exp(r863469);
        double r863471 = log(r863470);
        double r863472 = r863467 - r863471;
        double r863473 = 0.06331538098159631;
        bool r863474 = r863462 <= r863473;
        double r863475 = -0.5;
        double r863476 = 0.225;
        double r863477 = r863462 * r863476;
        double r863478 = r863462 * r863477;
        double r863479 = r863475 + r863478;
        double r863480 = -0.009642857142857142;
        double r863481 = r863462 * r863462;
        double r863482 = r863481 * r863481;
        double r863483 = r863480 * r863482;
        double r863484 = r863479 + r863483;
        double r863485 = r863474 ? r863484 : r863472;
        double r863486 = r863464 ? r863472 : r863485;
        return r863486;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if x < -0.0654189940460499 or 0.06331538098159631 < x

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied div-sub0.0

      \[\leadsto \color{blue}{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}}\]
    4. Using strategy rm
    5. Applied add-log-exp0.1

      \[\leadsto \frac{x}{x - \tan x} - \color{blue}{\log \left(e^{\frac{\sin x}{x - \tan x}}\right)}\]

    if -0.0654189940460499 < x < 0.06331538098159631

    1. Initial program 62.6

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Taylor expanded around 0 0.0

      \[\leadsto \color{blue}{\frac{9}{40} \cdot {x}^{2} - \left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)}\]
    3. Simplified0.0

      \[\leadsto \color{blue}{\frac{-27}{2800} \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) + \left(\frac{-1}{2} + x \cdot \left(x \cdot \frac{9}{40}\right)\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.0654189940460499:\\ \;\;\;\;\frac{x}{x - \tan x} - \log \left(e^{\frac{\sin x}{x - \tan x}}\right)\\ \mathbf{elif}\;x \le 0.06331538098159631:\\ \;\;\;\;\left(\frac{-1}{2} + x \cdot \left(x \cdot \frac{9}{40}\right)\right) + \frac{-27}{2800} \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x - \tan x} - \log \left(e^{\frac{\sin x}{x - \tan x}}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019158 
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  (/ (- x (sin x)) (- x (tan x))))