Average Error: 31.6 → 0.0
Time: 11.3s
Precision: binary64
\[\frac{x - \sin x}{x - \tan x} \]
\[\begin{array}{l} t_0 := \frac{x - \sin x}{x - \tan x}\\ \mathbf{if}\;x \leq -0.028886751310159164:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 0.030434030350276232:\\ \;\;\;\;\mathsf{fma}\left(0.225, x \cdot x, \mathsf{fma}\left({x}^{4}, -0.009642857142857142, -0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
(FPCore (x) :precision binary64 (/ (- x (sin x)) (- x (tan x))))
(FPCore (x)
 :precision binary64
 (let* ((t_0 (/ (- x (sin x)) (- x (tan x)))))
   (if (<= x -0.028886751310159164)
     t_0
     (if (<= x 0.030434030350276232)
       (fma 0.225 (* x x) (fma (pow x 4.0) -0.009642857142857142 -0.5))
       t_0))))
double code(double x) {
	return (x - sin(x)) / (x - tan(x));
}
double code(double x) {
	double t_0 = (x - sin(x)) / (x - tan(x));
	double tmp;
	if (x <= -0.028886751310159164) {
		tmp = t_0;
	} else if (x <= 0.030434030350276232) {
		tmp = fma(0.225, (x * x), fma(pow(x, 4.0), -0.009642857142857142, -0.5));
	} else {
		tmp = t_0;
	}
	return tmp;
}
function code(x)
	return Float64(Float64(x - sin(x)) / Float64(x - tan(x)))
end
function code(x)
	t_0 = Float64(Float64(x - sin(x)) / Float64(x - tan(x)))
	tmp = 0.0
	if (x <= -0.028886751310159164)
		tmp = t_0;
	elseif (x <= 0.030434030350276232)
		tmp = fma(0.225, Float64(x * x), fma((x ^ 4.0), -0.009642857142857142, -0.5));
	else
		tmp = t_0;
	end
	return tmp
end
code[x_] := N[(N[(x - N[Sin[x], $MachinePrecision]), $MachinePrecision] / N[(x - N[Tan[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_] := Block[{t$95$0 = N[(N[(x - N[Sin[x], $MachinePrecision]), $MachinePrecision] / N[(x - N[Tan[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -0.028886751310159164], t$95$0, If[LessEqual[x, 0.030434030350276232], N[(0.225 * N[(x * x), $MachinePrecision] + N[(N[Power[x, 4.0], $MachinePrecision] * -0.009642857142857142 + -0.5), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
t_0 := \frac{x - \sin x}{x - \tan x}\\
\mathbf{if}\;x \leq -0.028886751310159164:\\
\;\;\;\;t_0\\

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

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.02888675131015916 or 0.030434030350276232 < x

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x} \]

    if -0.02888675131015916 < x < 0.030434030350276232

    1. Initial program 63.3

      \[\frac{x - \sin x}{x - \tan x} \]
    2. Applied egg-rr63.7

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.225, x \cdot x, \mathsf{fma}\left({x}^{4}, -0.009642857142857142, -0.5\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

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

Reproduce

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