Average Error: 31.3 → 0.0
Time: 9.8s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.0264956549454682354 \lor \neg \left(x \le 0.029859806300954833\right):\\ \;\;\;\;\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{9}{40} \cdot {x}^{2} - \left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.0264956549454682354 \lor \neg \left(x \le 0.029859806300954833\right):\\
\;\;\;\;\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{9}{40} \cdot {x}^{2} - \left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)\\

\end{array}
double f(double x) {
        double r11658 = x;
        double r11659 = sin(r11658);
        double r11660 = r11658 - r11659;
        double r11661 = tan(r11658);
        double r11662 = r11658 - r11661;
        double r11663 = r11660 / r11662;
        return r11663;
}

double f(double x) {
        double r11664 = x;
        double r11665 = -0.026495654945468235;
        bool r11666 = r11664 <= r11665;
        double r11667 = 0.029859806300954833;
        bool r11668 = r11664 <= r11667;
        double r11669 = !r11668;
        bool r11670 = r11666 || r11669;
        double r11671 = sin(r11664);
        double r11672 = r11664 - r11671;
        double r11673 = tan(r11664);
        double r11674 = r11664 - r11673;
        double r11675 = r11672 / r11674;
        double r11676 = exp(r11675);
        double r11677 = log(r11676);
        double r11678 = 0.225;
        double r11679 = 2.0;
        double r11680 = pow(r11664, r11679);
        double r11681 = r11678 * r11680;
        double r11682 = 0.009642857142857142;
        double r11683 = 4.0;
        double r11684 = pow(r11664, r11683);
        double r11685 = r11682 * r11684;
        double r11686 = 0.5;
        double r11687 = r11685 + r11686;
        double r11688 = r11681 - r11687;
        double r11689 = r11670 ? r11677 : r11688;
        return r11689;
}

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.026495654945468235 or 0.029859806300954833 < x

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied add-log-exp0.1

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

    if -0.026495654945468235 < x < 0.029859806300954833

    1. Initial program 63.2

      \[\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. Recombined 2 regimes into one program.
  4. Final simplification0.0

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

Reproduce

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