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;
}
Try it out
Enter valid numbers for all inputs
Alternatives
| Alternative 1 |
|---|
| Error | 30.8 |
|---|
| Cost | 59072 |
|---|
\[\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 |
|---|
| Error | 31.5 |
|---|
| Cost | 45888 |
|---|
\[\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 |
|---|
| Error | 31.4 |
|---|
| Cost | 45760 |
|---|
\[\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 |
|---|
| Error | 55.6 |
|---|
| Cost | 45504 |
|---|
\[\left(\sqrt{x} + \sqrt{\sin x}\right) \cdot \frac{\sqrt{x} - \sqrt{\sin x}}{x - \tan x}\]
| Alternative 5 |
|---|
| Error | 52.8 |
|---|
| Cost | 39616 |
|---|
\[\frac{\frac{{x}^{3} - {\sin x}^{3}}{x \cdot x + \sin x \cdot \left(x + \sin x\right)}}{x - \tan x}\]
| Alternative 6 |
|---|
| Error | 62.3 |
|---|
| Cost | 26752 |
|---|
\[\frac{x - \sin x}{\left({x}^{3} \cdot -0.3333333333333333 - {x}^{5} \cdot 0.13333333333333333\right) - 0.05396825396825397 \cdot {x}^{7}}\]
| Alternative 7 |
|---|
| Error | 46.9 |
|---|
| Cost | 26560 |
|---|
\[\frac{x - \sin x}{\frac{x \cdot x - \tan x \cdot \tan x}{x + \tan x}}\]
| Alternative 8 |
|---|
| Error | 47.4 |
|---|
| Cost | 26496 |
|---|
\[\frac{\frac{x \cdot x - {\sin x}^{2}}{x + \sin x}}{x - \tan x}\]
| Alternative 9 |
|---|
| Error | 52.7 |
|---|
| Cost | 26112 |
|---|
\[\frac{\sqrt[3]{{\left(x - \sin x\right)}^{3}}}{x - \tan x}\]
| Alternative 10 |
|---|
| Error | 48.6 |
|---|
| Cost | 26048 |
|---|
\[\frac{e^{\log \left(x - \sin x\right)}}{x - \tan x}\]
| Alternative 11 |
|---|
| Error | 48.5 |
|---|
| Cost | 26048 |
|---|
\[\frac{x - \sin x}{e^{\log \left(x - \tan x\right)}}\]
| Alternative 12 |
|---|
| Error | 30.8 |
|---|
| Cost | 20032 |
|---|
\[\frac{1}{\frac{x}{x - \sin x} - \frac{\tan x}{x - \sin x}}\]
| Alternative 13 |
|---|
| Error | 33.1 |
|---|
| Cost | 20032 |
|---|
\[\sqrt[3]{{\left(\left(x \cdot x\right) \cdot 0.225 - \left(0.5 + 0.009642857142857142 \cdot {x}^{4}\right)\right)}^{3}}\]
| Alternative 14 |
|---|
| Error | 30.8 |
|---|
| Cost | 19904 |
|---|
\[\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\]
| Alternative 15 |
|---|
| Error | 30.8 |
|---|
| Cost | 13504 |
|---|
\[\frac{1}{\frac{1}{\frac{x - \sin x}{x - \tan x}}}\]
| Alternative 16 |
|---|
| Error | 30.8 |
|---|
| Cost | 13376 |
|---|
\[\frac{1}{\frac{x - \tan x}{x - \sin x}}\]
| Alternative 17 |
|---|
| Error | 62.4 |
|---|
| Cost | 13312 |
|---|
\[\frac{x - \sin x}{{x}^{3} \cdot -0.3333333333333333}\]
| Alternative 18 |
|---|
| Error | 30.8 |
|---|
| Cost | 13248 |
|---|
\[\frac{x - \sin x}{x - \tan x}\]
| Alternative 19 |
|---|
| Error | 32.6 |
|---|
| Cost | 7168 |
|---|
\[\left(\left(x \cdot x\right) \cdot 0.225 - 0.5\right) - 0.009642857142857142 \cdot {x}^{4}\]
| Alternative 20 |
|---|
| Error | 32.6 |
|---|
| Cost | 7168 |
|---|
\[\left(x \cdot x\right) \cdot 0.225 - \left(0.5 + 0.009642857142857142 \cdot {x}^{4}\right)\]
| Alternative 21 |
|---|
| Error | 31.1 |
|---|
| Cost | 6720 |
|---|
\[\frac{x - \sin x}{x}\]
| Alternative 22 |
|---|
| Error | 32.0 |
|---|
| Cost | 6720 |
|---|
\[\frac{x}{x - \tan x}\]
| Alternative 23 |
|---|
| Error | 31.9 |
|---|
| Cost | 448 |
|---|
\[\left(x \cdot x\right) \cdot 0.225 - 0.5\]
| Alternative 24 |
|---|
| Error | 32.4 |
|---|
| Cost | 64 |
|---|
\[-0.5\]
| Alternative 25 |
|---|
| Error | 31.6 |
|---|
| Cost | 64 |
|---|
\[1\]
| Alternative 26 |
|---|
| Error | 62.0 |
|---|
| Cost | 64 |
|---|
\[0\]
| Alternative 27 |
|---|
| Error | 57.6 |
|---|
| Cost | 64 |
|---|
\[-1\]
Error

Derivation
- Split input into 3 regimes
if x < -0.025909900776185827
Initial program 0.1
\[\frac{x - \sin x}{x - \tan x}\]
- Using strategy
rm Applied div-sub_binary640.1
\[\leadsto \color{blue}{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}}\]
Simplified0.1
\[\leadsto \color{blue}{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}}\]
if -0.025909900776185827 < x < 0.0297958845042710398
Initial program 63.1
\[\frac{x - \sin x}{x - \tan x}\]
Taylor expanded around 0 0.0
\[\leadsto \color{blue}{0.225 \cdot {x}^{2} - \left(0.009642857142857142 \cdot {x}^{4} + 0.5\right)}\]
Simplified0.0
\[\leadsto \color{blue}{\left(x \cdot x\right) \cdot 0.225 - \left(0.5 + 0.009642857142857142 \cdot {x}^{4}\right)}\]
- Using strategy
rm 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}}\]
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
Initial program 0.0
\[\frac{x - \sin x}{x - \tan x}\]
- Using strategy
rm Applied clear-num_binary640.0
\[\leadsto \color{blue}{\frac{1}{\frac{x - \tan x}{x - \sin x}}}\]
- Using strategy
rm Applied div-sub_binary640.0
\[\leadsto \frac{1}{\color{blue}{\frac{x}{x - \sin x} - \frac{\tan x}{x - \sin x}}}\]
Simplified0.0
\[\leadsto \color{blue}{\frac{1}{\frac{x}{x - \sin x} - \frac{\tan x}{x - \sin x}}}\]
- Recombined 3 regimes into one program.
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))))