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

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

\end{array}
double f(double x) {
        double r21659 = x;
        double r21660 = sin(r21659);
        double r21661 = r21659 - r21660;
        double r21662 = tan(r21659);
        double r21663 = r21659 - r21662;
        double r21664 = r21661 / r21663;
        return r21664;
}

double f(double x) {
        double r21665 = x;
        double r21666 = -7798915418074769.0;
        double r21667 = 2.8823037615171174e+17;
        double r21668 = r21666 / r21667;
        bool r21669 = r21665 <= r21668;
        double r21670 = 8668492433622581.0;
        double r21671 = r21670 / r21667;
        bool r21672 = r21665 <= r21671;
        double r21673 = !r21672;
        bool r21674 = r21669 || r21673;
        double r21675 = tan(r21665);
        double r21676 = r21665 - r21675;
        double r21677 = r21665 / r21676;
        double r21678 = sin(r21665);
        double r21679 = r21678 / r21676;
        double r21680 = r21677 - r21679;
        double r21681 = 9.0;
        double r21682 = 40.0;
        double r21683 = r21681 / r21682;
        double r21684 = 2.0;
        double r21685 = pow(r21665, r21684);
        double r21686 = r21683 * r21685;
        double r21687 = 27.0;
        double r21688 = 2800.0;
        double r21689 = r21687 / r21688;
        double r21690 = 4.0;
        double r21691 = pow(r21665, r21690);
        double r21692 = r21689 * r21691;
        double r21693 = 1.0;
        double r21694 = r21693 / r21684;
        double r21695 = r21692 + r21694;
        double r21696 = r21686 - r21695;
        double r21697 = r21674 ? r21680 : r21696;
        return r21697;
}

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.027057923325783554 or 0.03007487465186483 < x

    1. Initial program 0.1

      \[\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.027057923325783554 < x < 0.03007487465186483

    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. Simplified0.0

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

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

Reproduce

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