Average Error: 31.5 → 30.6
Time: 15.4s
Precision: binary64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x - \sin x}{x - \tan x} \leq 1.007754063695368:\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;\frac{x - \sin x}{x - \tan x} \leq 1.007754063695368:\\
\;\;\;\;\frac{x - \sin x}{x - \tan x}\\

\mathbf{else}:\\
\;\;\;\;0\\

\end{array}
(FPCore (x) :precision binary64 (/ (- x (sin x)) (- x (tan x))))
(FPCore (x)
 :precision binary64
 (if (<= (/ (- x (sin x)) (- x (tan x))) 1.007754063695368)
   (/ (- x (sin x)) (- x (tan x)))
   0.0))
double code(double x) {
	return (x - sin(x)) / (x - tan(x));
}
double code(double x) {
	double tmp;
	if (((x - sin(x)) / (x - tan(x))) <= 1.007754063695368) {
		tmp = (x - sin(x)) / (x - tan(x));
	} else {
		tmp = 0.0;
	}
	return tmp;
}

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 (/.f64 (-.f64 x (sin.f64 x)) (-.f64 x (tan.f64 x))) < 1.0077540636953679

    1. Initial program 0.6

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

    if 1.0077540636953679 < (/.f64 (-.f64 x (sin.f64 x)) (-.f64 x (tan.f64 x)))

    1. Initial program 63.7

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

      \[\leadsto \color{blue}{0 + 0 \cdot \left(x + {x}^{3}\right)}\]
    3. Simplified62.0

      \[\leadsto \color{blue}{0}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification30.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x - \sin x}{x - \tan x} \leq 1.007754063695368:\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array}\]

Reproduce

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