Average Error: 30.8 → 0.0
Time: 19.0s
Precision: binary64
Cost: 20674
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \leq -0.025909900776185827:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{elif}\;x \leq 0.02979588450427104:\\ \;\;\;\;\left(\left(x \cdot x\right) \cdot 0.225 - 0.5\right) - 0.009642857142857142 \cdot {x}^{4}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{x}{x - \sin x} - \frac{\tan x}{x - \sin x}}\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \leq -0.025909900776185827:\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\

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

\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{x}{x - \sin x} - \frac{\tan x}{x - \sin x}}\\

\end{array}
(FPCore (x) :precision binary64 (/ (- x (sin x)) (- x (tan x))))
(FPCore (x)
 :precision binary64
 (if (<= x -0.025909900776185827)
   (- (/ x (- x (tan x))) (/ (sin x) (- x (tan x))))
   (if (<= x 0.02979588450427104)
     (- (- (* (* x x) 0.225) 0.5) (* 0.009642857142857142 (pow x 4.0)))
     (/ 1.0 (- (/ x (- x (sin x))) (/ (tan x) (- x (sin x))))))))
double code(double x) {
	return (x - sin(x)) / (x - tan(x));
}
double code(double x) {
	double tmp;
	if (x <= -0.025909900776185827) {
		tmp = (x / (x - tan(x))) - (sin(x) / (x - tan(x)));
	} else if (x <= 0.02979588450427104) {
		tmp = (((x * x) * 0.225) - 0.5) - (0.009642857142857142 * pow(x, 4.0));
	} else {
		tmp = 1.0 / ((x / (x - sin(x))) - (tan(x) / (x - sin(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
Error30.8
Cost59072
\[\sqrt[3]{\frac{x - \sin x}{x - \tan x}} \cdot \left(\sqrt[3]{\frac{x - \sin x}{x - \tan x}} \cdot \sqrt[3]{\frac{x - \sin x}{x - \tan x}}\right)\]
Alternative 2
Error31.5
Cost45888
\[\frac{1}{\sqrt[3]{x - \tan x} \cdot \sqrt[3]{x - \tan x}} \cdot \frac{x - \sin x}{\sqrt[3]{x - \tan x}}\]
Alternative 3
Error31.4
Cost45760
\[\frac{\sqrt[3]{x - \sin x} \cdot \left(\sqrt[3]{x - \sin x} \cdot \sqrt[3]{x - \sin x}\right)}{x - \tan x}\]
Alternative 4
Error55.6
Cost45504
\[\left(\sqrt{x} + \sqrt{\sin x}\right) \cdot \frac{\sqrt{x} - \sqrt{\sin x}}{x - \tan x}\]
Alternative 5
Error52.8
Cost39616
\[\frac{\frac{{x}^{3} - {\sin x}^{3}}{x \cdot x + \sin x \cdot \left(x + \sin x\right)}}{x - \tan x}\]
Alternative 6
Error62.3
Cost26752
\[\frac{x - \sin x}{\left({x}^{3} \cdot -0.3333333333333333 - {x}^{5} \cdot 0.13333333333333333\right) - 0.05396825396825397 \cdot {x}^{7}}\]
Alternative 7
Error46.9
Cost26560
\[\frac{x - \sin x}{\frac{x \cdot x - \tan x \cdot \tan x}{x + \tan x}}\]
Alternative 8
Error47.4
Cost26496
\[\frac{\frac{x \cdot x - {\sin x}^{2}}{x + \sin x}}{x - \tan x}\]
Alternative 9
Error52.7
Cost26112
\[\frac{\sqrt[3]{{\left(x - \sin x\right)}^{3}}}{x - \tan x}\]
Alternative 10
Error48.6
Cost26048
\[\frac{e^{\log \left(x - \sin x\right)}}{x - \tan x}\]
Alternative 11
Error48.5
Cost26048
\[\frac{x - \sin x}{e^{\log \left(x - \tan x\right)}}\]
Alternative 12
Error30.8
Cost20032
\[\frac{1}{\frac{x}{x - \sin x} - \frac{\tan x}{x - \sin x}}\]
Alternative 13
Error33.1
Cost20032
\[\sqrt[3]{{\left(\left(x \cdot x\right) \cdot 0.225 - \left(0.5 + 0.009642857142857142 \cdot {x}^{4}\right)\right)}^{3}}\]
Alternative 14
Error30.8
Cost19904
\[\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\]
Alternative 15
Error30.8
Cost13504
\[\frac{1}{\frac{1}{\frac{x - \sin x}{x - \tan x}}}\]
Alternative 16
Error30.8
Cost13376
\[\frac{1}{\frac{x - \tan x}{x - \sin x}}\]
Alternative 17
Error62.4
Cost13312
\[\frac{x - \sin x}{{x}^{3} \cdot -0.3333333333333333}\]
Alternative 18
Error30.8
Cost13248
\[\frac{x - \sin x}{x - \tan x}\]
Alternative 19
Error32.6
Cost7168
\[\left(\left(x \cdot x\right) \cdot 0.225 - 0.5\right) - 0.009642857142857142 \cdot {x}^{4}\]
Alternative 20
Error32.6
Cost7168
\[\left(x \cdot x\right) \cdot 0.225 - \left(0.5 + 0.009642857142857142 \cdot {x}^{4}\right)\]
Alternative 21
Error31.1
Cost6720
\[\frac{x - \sin x}{x}\]
Alternative 22
Error32.0
Cost6720
\[\frac{x}{x - \tan x}\]
Alternative 23
Error31.9
Cost448
\[\left(x \cdot x\right) \cdot 0.225 - 0.5\]
Alternative 24
Error32.4
Cost64
\[-0.5\]
Alternative 25
Error31.6
Cost64
\[1\]
Alternative 26
Error62.0
Cost64
\[0\]
Alternative 27
Error57.6
Cost64
\[-1\]

Error

Derivation

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

    1. Initial program 0.1

      \[\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.025909900776185827 < x < 0.0297958845042710398

    1. Initial program 63.1

      \[\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.0297958845042710398 < x

    1. Initial program 0.0

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

      \[\leadsto \color{blue}{\frac{1}{\frac{x - \tan x}{x - \sin x}}}\]
    4. Using strategy rm
    5. Applied div-sub_binary640.0

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

      \[\leadsto \color{blue}{\frac{1}{\frac{x}{x - \sin x} - \frac{\tan x}{x - \sin x}}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.0

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

Reproduce

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