Average Error: 31.8 → 0.0
Time: 26.4s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.02818082991146234062007636111957253888249 \lor \neg \left(x \le 0.02677392735695169681542360251569334650412\right):\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{9}{40} \cdot {x}^{2} - \frac{27}{2800} \cdot {x}^{4}\right) - \frac{1}{2}\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.02818082991146234062007636111957253888249 \lor \neg \left(x \le 0.02677392735695169681542360251569334650412\right):\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\

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

\end{array}
double f(double x) {
        double r20689 = x;
        double r20690 = sin(r20689);
        double r20691 = r20689 - r20690;
        double r20692 = tan(r20689);
        double r20693 = r20689 - r20692;
        double r20694 = r20691 / r20693;
        return r20694;
}

double f(double x) {
        double r20695 = x;
        double r20696 = -0.02818082991146234;
        bool r20697 = r20695 <= r20696;
        double r20698 = 0.026773927356951697;
        bool r20699 = r20695 <= r20698;
        double r20700 = !r20699;
        bool r20701 = r20697 || r20700;
        double r20702 = tan(r20695);
        double r20703 = r20695 - r20702;
        double r20704 = r20695 / r20703;
        double r20705 = sin(r20695);
        double r20706 = r20705 / r20703;
        double r20707 = r20704 - r20706;
        double r20708 = 0.225;
        double r20709 = 2.0;
        double r20710 = pow(r20695, r20709);
        double r20711 = r20708 * r20710;
        double r20712 = 0.009642857142857142;
        double r20713 = 4.0;
        double r20714 = pow(r20695, r20713);
        double r20715 = r20712 * r20714;
        double r20716 = r20711 - r20715;
        double r20717 = 0.5;
        double r20718 = r20716 - r20717;
        double r20719 = r20701 ? r20707 : r20718;
        return r20719;
}

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.02818082991146234 or 0.026773927356951697 < x

    1. Initial program 0.0

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

      \[\leadsto \color{blue}{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}}\]

    if -0.02818082991146234 < x < 0.026773927356951697

    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. Using strategy rm
    4. Applied associate--r+0.0

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

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

Reproduce

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