Average Error: 30.9 → 0.0
Time: 28.8s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.029811193700198836:\\ \;\;\;\;\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)\\ \mathbf{elif}\;x \le 0.02832423247032738:\\ \;\;\;\;\left(\frac{9}{40} \cdot \left(x \cdot x\right) - \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \frac{27}{2800}\right) - \frac{1}{2}\\ \mathbf{else}:\\ \;\;\;\;\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.029811193700198836:\\
\;\;\;\;\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)\\

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

\mathbf{else}:\\
\;\;\;\;\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)\\

\end{array}
double f(double x) {
        double r494975 = x;
        double r494976 = sin(r494975);
        double r494977 = r494975 - r494976;
        double r494978 = tan(r494975);
        double r494979 = r494975 - r494978;
        double r494980 = r494977 / r494979;
        return r494980;
}

double f(double x) {
        double r494981 = x;
        double r494982 = -0.029811193700198836;
        bool r494983 = r494981 <= r494982;
        double r494984 = sin(r494981);
        double r494985 = r494981 - r494984;
        double r494986 = tan(r494981);
        double r494987 = r494981 - r494986;
        double r494988 = r494985 / r494987;
        double r494989 = exp(r494988);
        double r494990 = log(r494989);
        double r494991 = 0.02832423247032738;
        bool r494992 = r494981 <= r494991;
        double r494993 = 0.225;
        double r494994 = r494981 * r494981;
        double r494995 = r494993 * r494994;
        double r494996 = r494994 * r494994;
        double r494997 = 0.009642857142857142;
        double r494998 = r494996 * r494997;
        double r494999 = r494995 - r494998;
        double r495000 = 0.5;
        double r495001 = r494999 - r495000;
        double r495002 = r494992 ? r495001 : r494990;
        double r495003 = r494983 ? r494990 : r495002;
        return r495003;
}

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.029811193700198836 or 0.02832423247032738 < x

    1. Initial program 0.0

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

      \[\leadsto \color{blue}{\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)}\]

    if -0.029811193700198836 < x < 0.02832423247032738

    1. Initial program 62.8

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.029811193700198836:\\ \;\;\;\;\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)\\ \mathbf{elif}\;x \le 0.02832423247032738:\\ \;\;\;\;\left(\frac{9}{40} \cdot \left(x \cdot x\right) - \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \frac{27}{2800}\right) - \frac{1}{2}\\ \mathbf{else}:\\ \;\;\;\;\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)\\ \end{array}\]

Reproduce

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