Average Error: 31.5 → 0.1
Time: 24.4s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -1.569624820234627682324912711919751018286 \lor \neg \left(x \le 1.58747440237949755115209882205817848444\right):\\ \;\;\;\;\sqrt{\frac{x - \sin x}{x - \tan x}} \cdot \sqrt{\frac{x - \sin x}{x - \tan x}}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x, \frac{9}{40} \cdot x, \frac{-1}{2}\right) - \frac{27}{2800} \cdot {x}^{4}\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -1.569624820234627682324912711919751018286 \lor \neg \left(x \le 1.58747440237949755115209882205817848444\right):\\
\;\;\;\;\sqrt{\frac{x - \sin x}{x - \tan x}} \cdot \sqrt{\frac{x - \sin x}{x - \tan x}}\\

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

\end{array}
double f(double x) {
        double r21252 = x;
        double r21253 = sin(r21252);
        double r21254 = r21252 - r21253;
        double r21255 = tan(r21252);
        double r21256 = r21252 - r21255;
        double r21257 = r21254 / r21256;
        return r21257;
}

double f(double x) {
        double r21258 = x;
        double r21259 = -1.5696248202346277;
        bool r21260 = r21258 <= r21259;
        double r21261 = 1.5874744023794976;
        bool r21262 = r21258 <= r21261;
        double r21263 = !r21262;
        bool r21264 = r21260 || r21263;
        double r21265 = sin(r21258);
        double r21266 = r21258 - r21265;
        double r21267 = tan(r21258);
        double r21268 = r21258 - r21267;
        double r21269 = r21266 / r21268;
        double r21270 = sqrt(r21269);
        double r21271 = r21270 * r21270;
        double r21272 = 0.225;
        double r21273 = r21272 * r21258;
        double r21274 = -0.5;
        double r21275 = fma(r21258, r21273, r21274);
        double r21276 = 0.009642857142857142;
        double r21277 = 4.0;
        double r21278 = pow(r21258, r21277);
        double r21279 = r21276 * r21278;
        double r21280 = r21275 - r21279;
        double r21281 = r21264 ? r21271 : r21280;
        return r21281;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -1.5696248202346277 or 1.5874744023794976 < x

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt0.0

      \[\leadsto \color{blue}{\sqrt{\frac{x - \sin x}{x - \tan x}} \cdot \sqrt{\frac{x - \sin x}{x - \tan x}}}\]

    if -1.5696248202346277 < x < 1.5874744023794976

    1. Initial program 62.9

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Taylor expanded around 0 0.1

      \[\leadsto \color{blue}{\frac{9}{40} \cdot {x}^{2} - \left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)}\]
    3. Simplified0.1

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

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

Reproduce

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