Average Error: 30.9 → 0.0
Time: 30.2s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.025621427997812182:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.03210649578243009:\\ \;\;\;\;\frac{-1}{2} + \left(x \cdot x\right) \cdot \left(\frac{9}{40} - \left(x \cdot x\right) \cdot \frac{27}{2800}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.025621427997812182:\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\

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

\mathbf{else}:\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\

\end{array}
double f(double x) {
        double r846016 = x;
        double r846017 = sin(r846016);
        double r846018 = r846016 - r846017;
        double r846019 = tan(r846016);
        double r846020 = r846016 - r846019;
        double r846021 = r846018 / r846020;
        return r846021;
}

double f(double x) {
        double r846022 = x;
        double r846023 = -0.025621427997812182;
        bool r846024 = r846022 <= r846023;
        double r846025 = tan(r846022);
        double r846026 = r846022 - r846025;
        double r846027 = r846022 / r846026;
        double r846028 = sin(r846022);
        double r846029 = r846028 / r846026;
        double r846030 = r846027 - r846029;
        double r846031 = 0.03210649578243009;
        bool r846032 = r846022 <= r846031;
        double r846033 = -0.5;
        double r846034 = r846022 * r846022;
        double r846035 = 0.225;
        double r846036 = 0.009642857142857142;
        double r846037 = r846034 * r846036;
        double r846038 = r846035 - r846037;
        double r846039 = r846034 * r846038;
        double r846040 = r846033 + r846039;
        double r846041 = r846032 ? r846040 : r846030;
        double r846042 = r846024 ? r846030 : r846041;
        return r846042;
}

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.025621427997812182 or 0.03210649578243009 < 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}}\]

    if -0.025621427997812182 < x < 0.03210649578243009

    1. Initial program 62.8

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

      \[\leadsto \color{blue}{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}}\]
    4. 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)}\]
    5. Simplified0.0

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

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

Reproduce

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