Average Error: 31.4 → 0.7
Time: 9.3s
Precision: binary64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x - \sin x}{x - \tan x} \leq 1.0000000000049678:\\ \;\;\;\;\frac{1}{\frac{x - \tan x}{x - \sin x}}\\ \mathbf{else}:\\ \;\;\;\;-0.5\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;\frac{x - \sin x}{x - \tan x} \leq 1.0000000000049678:\\
\;\;\;\;\frac{1}{\frac{x - \tan x}{x - \sin x}}\\

\mathbf{else}:\\
\;\;\;\;-0.5\\

\end{array}
(FPCore (x) :precision binary64 (/ (- x (sin x)) (- x (tan x))))
(FPCore (x)
 :precision binary64
 (if (<= (/ (- x (sin x)) (- x (tan x))) 1.0000000000049678)
   (/ 1.0 (/ (- x (tan x)) (- x (sin x))))
   -0.5))
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.0000000000049678) {
		tmp = 1.0 / ((x - tan(x)) / (x - sin(x)));
	} else {
		tmp = -0.5;
	}
	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.0000000000049678

    1. Initial program 0.6

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied clear-num_binary640.6

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

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

    1. Initial program 63.2

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

      \[\leadsto \color{blue}{-0.5}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.7

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

Reproduce

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