Average Error: 31.5 → 0.3
Time: 1.8m
Precision: 64
Internal Precision: 2432
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot \left(x \cdot \frac{9}{40}\right) - (\frac{27}{2800} \cdot \left({x}^{4}\right) + \frac{1}{2})_* \le -0.5906833924321659:\\ \;\;\;\;(e^{\log_* (1 + \frac{x - \sin x}{x - \tan x})} - 1)^*\\ \mathbf{if}\;x \cdot \left(x \cdot \frac{9}{40}\right) - (\frac{27}{2800} \cdot \left({x}^{4}\right) + \frac{1}{2})_* \le -0.5:\\ \;\;\;\;x \cdot \left(x \cdot \frac{9}{40}\right) - (\frac{27}{2800} \cdot \left({x}^{4}\right) + \frac{1}{2})_*\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \end{array}\]

Error

Bits error versus x

Derivation

  1. Split input into 3 regimes
  2. if (- (* x (* x 9/40)) (fma 27/2800 (pow x 4) 1/2)) < -0.5906833924321659

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied expm1-log1p-u0.0

      \[\leadsto \color{blue}{(e^{\log_* (1 + \frac{x - \sin x}{x - \tan x})} - 1)^*}\]

    if -0.5906833924321659 < (- (* x (* x 9/40)) (fma 27/2800 (pow x 4) 1/2)) < -0.5

    1. Initial program 63.6

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

      \[\leadsto \color{blue}{\frac{9}{40} \cdot {x}^{2} - \left(\frac{1}{2} + \frac{27}{2800} \cdot {x}^{4}\right)}\]
    3. Applied simplify0

      \[\leadsto \color{blue}{x \cdot \left(x \cdot \frac{9}{40}\right) - (\frac{27}{2800} \cdot \left({x}^{4}\right) + \frac{1}{2})_*}\]

    if -0.5 < (- (* x (* x 9/40)) (fma 27/2800 (pow x 4) 1/2))

    1. Initial program 1.2

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

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

Runtime

Time bar (total: 1.8m)Debug logProfile

herbie shell --seed '#(1070991898 1055468627 4280279443 640792587 928206309 3646738750)' +o rules:numerics
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  (/ (- x (sin x)) (- x (tan x))))