Average Error: 31.9 → 0.0
Time: 33.2s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.025688062190600255:\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.03204447297348137:\\ \;\;\;\;\left(\frac{9}{40} - \frac{27}{2800} \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) - \frac{1}{2}\\ \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.025688062190600255:\\
\;\;\;\;\frac{x - \sin x}{x - \tan x}\\

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

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

\end{array}
double f(double x) {
        double r509998 = x;
        double r509999 = sin(r509998);
        double r510000 = r509998 - r509999;
        double r510001 = tan(r509998);
        double r510002 = r509998 - r510001;
        double r510003 = r510000 / r510002;
        return r510003;
}

double f(double x) {
        double r510004 = x;
        double r510005 = -0.025688062190600255;
        bool r510006 = r510004 <= r510005;
        double r510007 = sin(r510004);
        double r510008 = r510004 - r510007;
        double r510009 = tan(r510004);
        double r510010 = r510004 - r510009;
        double r510011 = r510008 / r510010;
        double r510012 = 0.03204447297348137;
        bool r510013 = r510004 <= r510012;
        double r510014 = 0.225;
        double r510015 = 0.009642857142857142;
        double r510016 = r510004 * r510004;
        double r510017 = r510015 * r510016;
        double r510018 = r510014 - r510017;
        double r510019 = r510018 * r510016;
        double r510020 = 0.5;
        double r510021 = r510019 - r510020;
        double r510022 = r510013 ? r510021 : r510011;
        double r510023 = r510006 ? r510011 : r510022;
        return r510023;
}

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.025688062190600255 or 0.03204447297348137 < x

    1. Initial program 0.0

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

    if -0.025688062190600255 < x < 0.03204447297348137

    1. Initial program 62.8

      \[\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 \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.025688062190600255:\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.03204447297348137:\\ \;\;\;\;\left(\frac{9}{40} - \frac{27}{2800} \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) - \frac{1}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \end{array}\]

Reproduce

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