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

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

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

\end{array}
double f(double x) {
        double r3658515 = x;
        double r3658516 = sin(r3658515);
        double r3658517 = r3658515 - r3658516;
        double r3658518 = tan(r3658515);
        double r3658519 = r3658515 - r3658518;
        double r3658520 = r3658517 / r3658519;
        return r3658520;
}

double f(double x) {
        double r3658521 = x;
        double r3658522 = -0.02824847505594847;
        bool r3658523 = r3658521 <= r3658522;
        double r3658524 = sin(r3658521);
        double r3658525 = r3658521 - r3658524;
        double r3658526 = tan(r3658521);
        double r3658527 = r3658521 - r3658526;
        double r3658528 = r3658525 / r3658527;
        double r3658529 = 0.030074814014808618;
        bool r3658530 = r3658521 <= r3658529;
        double r3658531 = r3658521 * r3658521;
        double r3658532 = 0.225;
        double r3658533 = r3658531 * r3658532;
        double r3658534 = 0.009642857142857142;
        double r3658535 = r3658531 * r3658531;
        double r3658536 = r3658534 * r3658535;
        double r3658537 = 0.5;
        double r3658538 = r3658536 + r3658537;
        double r3658539 = r3658533 - r3658538;
        double r3658540 = r3658530 ? r3658539 : r3658528;
        double r3658541 = r3658523 ? r3658528 : r3658540;
        return r3658541;
}

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.02824847505594847 or 0.030074814014808618 < x

    1. Initial program 0.1

      \[\frac{x - \sin x}{x - \tan x}\]

    if -0.02824847505594847 < x < 0.030074814014808618

    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}{\left(x \cdot x\right) \cdot \frac{9}{40} - \left(\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \frac{27}{2800} + \frac{1}{2}\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

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

Reproduce

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