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

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

\end{array}
double f(double x) {
        double r12105 = x;
        double r12106 = sin(r12105);
        double r12107 = r12105 - r12106;
        double r12108 = tan(r12105);
        double r12109 = r12105 - r12108;
        double r12110 = r12107 / r12109;
        return r12110;
}

double f(double x) {
        double r12111 = x;
        double r12112 = -0.030137210439935006;
        bool r12113 = r12111 <= r12112;
        double r12114 = 0.028890275250899152;
        bool r12115 = r12111 <= r12114;
        double r12116 = !r12115;
        bool r12117 = r12113 || r12116;
        double r12118 = sin(r12111);
        double r12119 = r12111 - r12118;
        double r12120 = tan(r12111);
        double r12121 = r12111 - r12120;
        double r12122 = r12119 / r12121;
        double r12123 = 0.225;
        double r12124 = 2.0;
        double r12125 = pow(r12111, r12124);
        double r12126 = r12123 * r12125;
        double r12127 = 0.009642857142857142;
        double r12128 = 4.0;
        double r12129 = pow(r12111, r12128);
        double r12130 = r12127 * r12129;
        double r12131 = r12126 - r12130;
        double r12132 = 0.5;
        double r12133 = r12131 - r12132;
        double r12134 = r12117 ? r12122 : r12133;
        return r12134;
}

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.030137210439935006 or 0.028890275250899152 < x

    1. Initial program 0.0

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

    if -0.030137210439935006 < x < 0.028890275250899152

    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. Using strategy rm
    4. Applied associate--r+0.0

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

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

Reproduce

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