Average Error: 30.9 → 0.5
Time: 9.0s
Precision: binary64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \leq -4.504252256196449:\\ \;\;\;\;\frac{x - \sin x}{x}\\ \mathbf{elif}\;x \leq 0.004713351902741206:\\ \;\;\;\;0.225 \cdot {x}^{2} - 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \leq -4.504252256196449:\\
\;\;\;\;\frac{x - \sin x}{x}\\

\mathbf{elif}\;x \leq 0.004713351902741206:\\
\;\;\;\;0.225 \cdot {x}^{2} - 0.5\\

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

\end{array}
(FPCore (x) :precision binary64 (/ (- x (sin x)) (- x (tan x))))
(FPCore (x)
 :precision binary64
 (if (<= x -4.504252256196449)
   (/ (- x (sin x)) x)
   (if (<= x 0.004713351902741206)
     (- (* 0.225 (pow x 2.0)) 0.5)
     (/ (- 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 <= -4.504252256196449) {
		tmp = (x - sin(x)) / x;
	} else if (x <= 0.004713351902741206) {
		tmp = (0.225 * pow(x, 2.0)) - 0.5;
	} else {
		tmp = (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

Derivation

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

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Taylor expanded around inf 1.3

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

    if -4.50425225619644909 < x < 0.0047133519027412057

    1. Initial program 63.0

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

      \[\leadsto \color{blue}{0.225 \cdot {x}^{2} - 0.5}\]

    if 0.0047133519027412057 < x

    1. Initial program 0.1

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.504252256196449:\\ \;\;\;\;\frac{x - \sin x}{x}\\ \mathbf{elif}\;x \leq 0.004713351902741206:\\ \;\;\;\;0.225 \cdot {x}^{2} - 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \end{array}\]

Alternatives

Reproduce

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