Average Error: 31.6 → 0.0
Time: 43.0s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.026376176867215075:\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.027884417195576005:\\ \;\;\;\;\mathsf{fma}\left(\left(x \cdot x\right), \left(\mathsf{fma}\left(\left(x \cdot x\right), \frac{-27}{2800}, \frac{9}{40}\right)\right), \frac{-1}{2}\right)\\ \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.026376176867215075:\\
\;\;\;\;\frac{x - \sin x}{x - \tan x}\\

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

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

\end{array}
double f(double x) {
        double r931911 = x;
        double r931912 = sin(r931911);
        double r931913 = r931911 - r931912;
        double r931914 = tan(r931911);
        double r931915 = r931911 - r931914;
        double r931916 = r931913 / r931915;
        return r931916;
}

double f(double x) {
        double r931917 = x;
        double r931918 = -0.026376176867215075;
        bool r931919 = r931917 <= r931918;
        double r931920 = sin(r931917);
        double r931921 = r931917 - r931920;
        double r931922 = tan(r931917);
        double r931923 = r931917 - r931922;
        double r931924 = r931921 / r931923;
        double r931925 = 0.027884417195576005;
        bool r931926 = r931917 <= r931925;
        double r931927 = r931917 * r931917;
        double r931928 = -0.009642857142857142;
        double r931929 = 0.225;
        double r931930 = fma(r931927, r931928, r931929);
        double r931931 = -0.5;
        double r931932 = fma(r931927, r931930, r931931);
        double r931933 = r931926 ? r931932 : r931924;
        double r931934 = r931919 ? r931924 : r931933;
        return r931934;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.026376176867215075 or 0.027884417195576005 < x

    1. Initial program 0.1

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

    if -0.026376176867215075 < x < 0.027884417195576005

    1. Initial program 62.7

      \[\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}{\mathsf{fma}\left(\left(x \cdot x\right), \left(\mathsf{fma}\left(\left(x \cdot x\right), \frac{-27}{2800}, \frac{9}{40}\right)\right), \frac{-1}{2}\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.026376176867215075:\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.027884417195576005:\\ \;\;\;\;\mathsf{fma}\left(\left(x \cdot x\right), \left(\mathsf{fma}\left(\left(x \cdot x\right), \frac{-27}{2800}, \frac{9}{40}\right)\right), \frac{-1}{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \end{array}\]

Reproduce

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