Average Error: 31.5 → 0.0
Time: 3.0min
Precision: binary64
Cost: 26690
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \leq -0.03145921990197293:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{elif}\;x \leq 0.028382328502402018:\\ \;\;\;\;\left(x \cdot x\right) \cdot 0.225 - \left(0.5 + {x}^{4} \cdot 0.009642857142857142\right)\\ \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 \leq -0.03145921990197293:\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\

\mathbf{elif}\;x \leq 0.028382328502402018:\\
\;\;\;\;\left(x \cdot x\right) \cdot 0.225 - \left(0.5 + {x}^{4} \cdot 0.009642857142857142\right)\\

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

\end{array}
(FPCore (x) :precision binary64 (/ (- x (sin x)) (- x (tan x))))
(FPCore (x)
 :precision binary64
 (if (<= x -0.03145921990197293)
   (- (/ x (- x (tan x))) (/ (sin x) (- x (tan x))))
   (if (<= x 0.028382328502402018)
     (- (* (* x x) 0.225) (+ 0.5 (* (pow x 4.0) 0.009642857142857142)))
     (log (exp (/ (- x (sin x)) (- x (tan x))))))))
double code(double x) {
	return (x - sin(x)) / (x - tan(x));
}
double code(double x) {
	double tmp;
	if (x <= -0.03145921990197293) {
		tmp = (x / (x - tan(x))) - (sin(x) / (x - tan(x)));
	} else if (x <= 0.028382328502402018) {
		tmp = ((x * x) * 0.225) - (0.5 + (pow(x, 4.0) * 0.009642857142857142));
	} else {
		tmp = log(exp((x - sin(x)) / (x - tan(x))));
	}
	return tmp;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Alternatives

Alternative 1
Error0.0
Cost20225
\[\begin{array}{l} \mathbf{if}\;x \leq -0.03145921990197293:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{elif}\;x \leq 0.028382328502402018:\\ \;\;\;\;\left(x \cdot x\right) \cdot 0.225 - \left(0.5 + {x}^{4} \cdot 0.009642857142857142\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \end{array}\]
Alternative 2
Error0.0
Cost13576
\[\begin{array}{l} \mathbf{if}\;x \leq -0.029701072230053045 \lor \neg \left(x \leq 0.028382328502402018\right):\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot x\right) \cdot 0.225 - \left(0.5 + {x}^{4} \cdot 0.009642857142857142\right)\\ \end{array}\]
Alternative 3
Error0.7
Cost7810
\[\begin{array}{l} \mathbf{if}\;x \leq -2.7831107132547697:\\ \;\;\;\;\frac{x}{x - \tan x}\\ \mathbf{elif}\;x \leq 2.8883948314408894:\\ \;\;\;\;\left(x \cdot x\right) \cdot 0.225 - \left(0.5 + {x}^{4} \cdot 0.009642857142857142\right)\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array}\]
Alternative 4
Error0.7
Cost7810
\[\begin{array}{l} \mathbf{if}\;x \leq -2.8536616560145953:\\ \;\;\;\;\frac{x}{x - \tan x}\\ \mathbf{elif}\;x \leq 2.980031341429843:\\ \;\;\;\;\left(x \cdot x\right) \cdot 0.225 - \left(0.5 + {x}^{4} \cdot 0.009047619047619047\right)\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array}\]
Alternative 5
Error0.8
Cost7041
\[\begin{array}{l} \mathbf{if}\;x \leq -2.289254113935988:\\ \;\;\;\;\frac{x}{x - \tan x}\\ \mathbf{elif}\;x \leq 2.6134853014740287:\\ \;\;\;\;\left(x \cdot x\right) \cdot 0.225 + -0.5\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array}\]
Alternative 6
Error0.8
Cost7041
\[\begin{array}{l} \mathbf{if}\;x \leq -2.289254113935988:\\ \;\;\;\;\frac{x - \sin x}{x}\\ \mathbf{elif}\;x \leq 2.6134853014740287:\\ \;\;\;\;\left(x \cdot x\right) \cdot 0.225 + -0.5\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array}\]
Alternative 7
Error0.8
Cost1090
\[\begin{array}{l} \mathbf{if}\;x \leq -2.5714578849752914:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 2.6134853014740287:\\ \;\;\;\;\left(x \cdot x\right) \cdot 0.225 + -0.5\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array}\]
Alternative 8
Error1.0
Cost706
\[\begin{array}{l} \mathbf{if}\;x \leq -1.580219514889386:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 1.5736505708253863:\\ \;\;\;\;-0.5\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array}\]
Alternative 9
Error32.1
Cost64
\[1\]

Error

Time

Derivation

  1. Split input into 3 regimes
  2. if x < -0.0314592199019729304

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied div-sub_binary640.0

      \[\leadsto \color{blue}{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}}\]
    4. Simplified0.0

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

    if -0.0314592199019729304 < x < 0.0283823285024020176

    1. Initial program 63.3

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied flip3--_binary6463.4

      \[\leadsto \frac{x - \sin x}{\color{blue}{\frac{{x}^{3} - {\tan x}^{3}}{x \cdot x + \left(\tan x \cdot \tan x + x \cdot \tan x\right)}}}\]
    4. Applied associate-/r/_binary6463.4

      \[\leadsto \color{blue}{\frac{x - \sin x}{{x}^{3} - {\tan x}^{3}} \cdot \left(x \cdot x + \left(\tan x \cdot \tan x + x \cdot \tan x\right)\right)}\]
    5. Taylor expanded around 0 0.0

      \[\leadsto \color{blue}{0.225 \cdot {x}^{2} - \left(0.009642857142857142 \cdot {x}^{4} + 0.5\right)}\]
    6. Simplified0.0

      \[\leadsto \color{blue}{\left(x \cdot x\right) \cdot 0.225 - \left(0.5 + {x}^{4} \cdot 0.009642857142857142\right)}\]
    7. Simplified0.0

      \[\leadsto \color{blue}{\left(x \cdot x\right) \cdot 0.225 - \left(0.5 + {x}^{4} \cdot 0.009642857142857142\right)}\]

    if 0.0283823285024020176 < x

    1. Initial program 0.1

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

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

      \[\leadsto \color{blue}{\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -0.03145921990197293:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{elif}\;x \leq 0.028382328502402018:\\ \;\;\;\;\left(x \cdot x\right) \cdot 0.225 - \left(0.5 + {x}^{4} \cdot 0.009642857142857142\right)\\ \mathbf{else}:\\ \;\;\;\;\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)\\ \end{array}\]

Reproduce

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