Average Error: 31.1 → 0.0
Time: 27.0s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.02963816903464042487592600139123533153906:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.02866242393931728651979007338468363741413:\\ \;\;\;\;\frac{9}{40} \cdot {x}^{2} - \mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.02963816903464042487592600139123533153906:\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\

\mathbf{elif}\;x \le 0.02866242393931728651979007338468363741413:\\
\;\;\;\;\frac{9}{40} \cdot {x}^{2} - \mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\\

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

\end{array}
double f(double x) {
        double r24036 = x;
        double r24037 = sin(r24036);
        double r24038 = r24036 - r24037;
        double r24039 = tan(r24036);
        double r24040 = r24036 - r24039;
        double r24041 = r24038 / r24040;
        return r24041;
}

double f(double x) {
        double r24042 = x;
        double r24043 = -0.029638169034640425;
        bool r24044 = r24042 <= r24043;
        double r24045 = tan(r24042);
        double r24046 = r24042 - r24045;
        double r24047 = r24042 / r24046;
        double r24048 = sin(r24042);
        double r24049 = r24048 / r24046;
        double r24050 = r24047 - r24049;
        double r24051 = 0.028662423939317287;
        bool r24052 = r24042 <= r24051;
        double r24053 = 0.225;
        double r24054 = 2.0;
        double r24055 = pow(r24042, r24054);
        double r24056 = r24053 * r24055;
        double r24057 = 0.009642857142857142;
        double r24058 = 4.0;
        double r24059 = pow(r24042, r24058);
        double r24060 = 0.5;
        double r24061 = fma(r24057, r24059, r24060);
        double r24062 = r24056 - r24061;
        double r24063 = r24042 - r24048;
        double r24064 = r24063 / r24046;
        double r24065 = exp(r24064);
        double r24066 = log(r24065);
        double r24067 = r24052 ? r24062 : r24066;
        double r24068 = r24044 ? r24050 : r24067;
        return r24068;
}

Error

Bits error versus x

Derivation

  1. Split input into 3 regimes
  2. if x < -0.029638169034640425

    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}}\]

    if -0.029638169034640425 < x < 0.028662423939317287

    1. Initial program 63.3

      \[\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{9}{40} \cdot {x}^{2} - \mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)}\]

    if 0.028662423939317287 < x

    1. Initial program 0.0

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

      \[\leadsto \color{blue}{\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.0

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

Reproduce

herbie shell --seed 2019325 +o rules:numerics
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  :precision binary64
  (/ (- x (sin x)) (- x (tan x))))