Average Error: 31.5 → 0.1
Time: 25.6s
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 r25923 = x;
        double r25924 = sin(r25923);
        double r25925 = r25923 - r25924;
        double r25926 = tan(r25923);
        double r25927 = r25923 - r25926;
        double r25928 = r25925 / r25927;
        return r25928;
}

double f(double x) {
        double r25929 = x;
        double r25930 = -1.5696248202346277;
        bool r25931 = r25929 <= r25930;
        double r25932 = 1.5874744023794976;
        bool r25933 = r25929 <= r25932;
        double r25934 = !r25933;
        bool r25935 = r25931 || r25934;
        double r25936 = sin(r25929);
        double r25937 = r25929 - r25936;
        double r25938 = tan(r25929);
        double r25939 = r25929 - r25938;
        double r25940 = r25937 / r25939;
        double r25941 = sqrt(r25940);
        double r25942 = r25941 * r25941;
        double r25943 = 0.225;
        double r25944 = r25943 * r25929;
        double r25945 = -0.5;
        double r25946 = fma(r25929, r25944, r25945);
        double r25947 = 0.009642857142857142;
        double r25948 = 4.0;
        double r25949 = pow(r25929, r25948);
        double r25950 = r25947 * r25949;
        double r25951 = r25946 - r25950;
        double r25952 = r25935 ? r25942 : r25951;
        return r25952;
}

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))))