Average Error: 31.0 → 0.0
Time: 10.6s
Precision: binary64
Cost: 80194
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \leq -0.03249701931273373:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{elif}\;x \leq 0.02883492941991452:\\ \;\;\;\;\left(\left(x \cdot x\right) \cdot 0.225 + -0.5\right) - 0.009642857142857142 \cdot {x}^{4}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(\frac{x}{x - \tan x}\right)}^{3} - {\left(\frac{\sin x}{x - \tan x}\right)}^{3}}{\frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x} \cdot \left(\frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x}\right)}\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \leq -0.03249701931273373:\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\

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

\mathbf{else}:\\
\;\;\;\;\frac{{\left(\frac{x}{x - \tan x}\right)}^{3} - {\left(\frac{\sin x}{x - \tan x}\right)}^{3}}{\frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x} \cdot \left(\frac{x}{x - \tan x} + \frac{\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.03249701931273373)
   (- (/ x (- x (tan x))) (/ (sin x) (- x (tan x))))
   (if (<= x 0.02883492941991452)
     (- (+ (* (* x x) 0.225) -0.5) (* 0.009642857142857142 (pow x 4.0)))
     (/
      (- (pow (/ x (- x (tan x))) 3.0) (pow (/ (sin x) (- x (tan x))) 3.0))
      (+
       (* (/ x (- x (tan x))) (/ x (- x (tan x))))
       (*
        (/ (sin x) (- x (tan x)))
        (+ (/ x (- x (tan 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.03249701931273373) {
		tmp = (x / (x - tan(x))) - (sin(x) / (x - tan(x)));
	} else if (x <= 0.02883492941991452) {
		tmp = (((x * x) * 0.225) + -0.5) - (0.009642857142857142 * pow(x, 4.0));
	} else {
		tmp = (pow((x / (x - tan(x))), 3.0) - pow((sin(x) / (x - tan(x))), 3.0)) / (((x / (x - tan(x))) * (x / (x - tan(x)))) + ((sin(x) / (x - tan(x))) * ((x / (x - tan(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
Cost20232
\[\begin{array}{l} \mathbf{if}\;x \leq -0.03249701931273373 \lor \neg \left(x \leq 0.02883492941991452\right):\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{else}:\\ \;\;\;\;\left(\left(x \cdot x\right) \cdot 0.225 + -0.5\right) - 0.009642857142857142 \cdot {x}^{4}\\ \end{array}\]
Alternative 2
Error0.0
Cost14018
\[\begin{array}{l} \mathbf{if}\;x \leq -0.027646303307784493:\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \mathbf{elif}\;x \leq 0.027931797038213965:\\ \;\;\;\;\left(\left(x \cdot x\right) \cdot 0.225 + -0.5\right) - 0.009642857142857142 \cdot {x}^{4}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{x - \tan x}{x - \sin x}}\\ \end{array}\]
Alternative 3
Error0.0
Cost13576
\[\begin{array}{l} \mathbf{if}\;x \leq -0.027646303307784493 \lor \neg \left(x \leq 0.027931797038213965\right):\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \mathbf{else}:\\ \;\;\;\;\left(\left(x \cdot x\right) \cdot 0.225 + -0.5\right) - 0.009642857142857142 \cdot {x}^{4}\\ \end{array}\]
Alternative 4
Error0.7
Cost7496
\[\begin{array}{l} \mathbf{if}\;x \leq -2.7411376912888787 \lor \neg \left(x \leq 2.8145701106272707\right):\\ \;\;\;\;\frac{x}{x - \tan x}\\ \mathbf{else}:\\ \;\;\;\;\left(\left(x \cdot x\right) \cdot 0.225 + -0.5\right) - 0.009642857142857142 \cdot {x}^{4}\\ \end{array}\]
Alternative 5
Error0.8
Cost7048
\[\begin{array}{l} \mathbf{if}\;x \leq -2.3082717611940438 \lor \neg \left(x \leq 2.241160692489287\right):\\ \;\;\;\;\frac{x}{x - \tan x}\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot x\right) \cdot 0.225 + -0.5\\ \end{array}\]
Alternative 6
Error0.8
Cost7041
\[\begin{array}{l} \mathbf{if}\;x \leq -2.3082717611940438:\\ \;\;\;\;\frac{x - \sin x}{x}\\ \mathbf{elif}\;x \leq 2.5597214803437227:\\ \;\;\;\;\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.63292120876517:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 2.5597214803437227:\\ \;\;\;\;\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.558945226716624:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 1.5790270068921035:\\ \;\;\;\;-0.5\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array}\]
Alternative 9
Error26.3
Cost706
\[\begin{array}{l} \mathbf{if}\;x \leq -1.558945226716624:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 1.5790270068921035:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array}\]
Alternative 10
Error31.7
Cost64
\[1\]

Error

Derivation

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

    1. Initial program 0.0

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

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

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

    if -0.03249701931273373 < x < 0.0288349294199145186

    1. Initial program 63.2

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

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

      \[\leadsto \color{blue}{\left(x \cdot x\right) \cdot 0.225 - \left(0.5 + 0.009642857142857142 \cdot {x}^{4}\right)}\]
    4. Using strategy rm
    5. Applied associate--r+_binary640.0

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

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

    if 0.0288349294199145186 < x

    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. Using strategy rm
    5. Applied flip3--_binary640.0

      \[\leadsto \color{blue}{\frac{{\left(\frac{x}{x - \tan x}\right)}^{3} - {\left(\frac{\sin x}{x - \tan x}\right)}^{3}}{\frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x} + \left(\frac{\sin x}{x - \tan x} \cdot \frac{\sin x}{x - \tan x} + \frac{x}{x - \tan x} \cdot \frac{\sin x}{x - \tan x}\right)}}\]
    6. Simplified0.0

      \[\leadsto \frac{{\left(\frac{x}{x - \tan x}\right)}^{3} - {\left(\frac{\sin x}{x - \tan x}\right)}^{3}}{\color{blue}{\frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x} \cdot \left(\frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x}\right)}}\]
    7. Simplified0.0

      \[\leadsto \color{blue}{\frac{{\left(\frac{x}{x - \tan x}\right)}^{3} - {\left(\frac{\sin x}{x - \tan x}\right)}^{3}}{\frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x} \cdot \left(\frac{x}{x - \tan x} + \frac{\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.03249701931273373:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{elif}\;x \leq 0.02883492941991452:\\ \;\;\;\;\left(\left(x \cdot x\right) \cdot 0.225 + -0.5\right) - 0.009642857142857142 \cdot {x}^{4}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(\frac{x}{x - \tan x}\right)}^{3} - {\left(\frac{\sin x}{x - \tan x}\right)}^{3}}{\frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x} \cdot \left(\frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x}\right)}\\ \end{array}\]

Reproduce

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